Email verifications are not sent (other emails work)
-
Yes the checkmark is there. I have access to the PostgreSQL db, but the model is really twisted, I don't know where to find user data.
Table list:
- legacy_hash
- legacy_list
- legacy_object
- legacy_set
- legacy_string
- legacy_zset
- searchchat
- searchpost
- searchtopic
- session
-
wrote last edited by [email protected]
baris Here is a typical problematic user hash: the user registered, entered an email (because forced to via configuration), but never received a confirmation email:
{ "uid": 21, "status": "online", "joindate": 1748003306464, "password": "$2b$12$w...nMKtMZ.", "username": "(redacted)", "userslug": "(redacted)", "lastonline": 1748003306464, "profileviews": 1, "password:shaWrapped": 1 }
I see the provided email address in the approval queue, but when I approve the user, the email address is not added to the approved user.
-
wrote last edited by [email protected]
I see hashes like that, but they all have "forced" = true, so I think it's email sending tests:
{ "eid": 4, "uid": 1, "type": "email-confirmation-sent", "email": "(redacted)", "force": true, "timestamp": 1739543397355, "confirm_code": "fa8efa3e-e3a5-4522-b2bd-5656e6b79795" }
Edit: I'm on nodebb 4.2.0.
-
creozote If you see that event in the events page that means the code reached all the way to the email sending logic here https://github.com/NodeBB/NodeBB/blob/master/src/user/email.js#L165-L176.
You can open up
src/emailer.js
and add some console.logs to see if the email is being sent. Put a log before this line and see what thedata
object has. -
That's the issue: the "email-confirmation-sent" events don't occur unless I force them by using the email testing feature in /admin/settings/email => "Email testing".
-
In short:
- email confirmation works via the email testing in /admin/settings/email => "Email testing"
- email confirmation doesn't trigger when a user subscribes
-
Here are the installed plugins, nothing crazy:
-
wrote last edited by [email protected]
I have edited the JS function this way and rebuilt nodebb:
Emailer.sendViaFallback = async (data) => { // Some minor alterations to the data to conform to nodemailer standard data.text = data.plaintext; delete data.plaintext; // use an address object https://nodemailer.com/message/addresses/ data.from = { name: data.from_name, address: data.from, }; delete data.from_name; console.log(data); await Emailer.fallbackTransport.sendMail(data); };
I subscribed a user, but I don't see any relevant output in /admin/advanced/logs:
2025-05-23T15:41:36.438Z [43589/1152228] - [32minfo[39m: 🎉 NodeBB Ready 2025-05-23T15:41:36.439Z [43589/1152228] - [32minfo[39m: 🤝 Enabling 'trust proxy' 2025-05-23T15:41:36.441Z [43589/1152228] - [32minfo[39m: 📡 NodeBB is now listening on: 127.0.0.1:xxx 2025-05-23T15:41:36.441Z [43589/1152228] - [32minfo[39m: 🔗 Canonical URL: https://forum.xxx.com/ io: 0 emit [ 'checkSession', 0 ] io: 0 emit [ 'setHostname', 'xxx.com' ] io: 0 emit [ 'checkSession', 0 ] io: 0 emit [ 'setHostname', 'xxx.com' ] io: 0 on [ { type: 2, nsp: '/', id: 0, data: [ 'meta.reconnected', null ] } ] io: 0 on [ { type: 2, nsp: '/', id: 7, data: [ 'meta.reconnected', null ] } ] io: 3 emit [ 'checkSession', 3 ] io: 3 emit [ 'setHostname', 'xxx.com' ] io: 3 on [ { type: 2, nsp: '/', id: 11, data: [ 'meta.reconnected', null ] } ] 2.10.184.192 - - [23/May/2025:15:41:39 +0000] "GET /assets/uploads/system/favicon.ico?v=0daa45086ca HTTP/1.1" 404 9 "https://forum.xxx.com/admin/advanced/events" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2.10.184.192 - - [23/May/2025:15:41:39 +0000] "GET /api/v3/chats/unread HTTP/1.1" 304 - "https://forum.xxx.com/admin/advanced/events" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" WARNING: The keyword 'none' must be used as a single argument. ../../../bootstrap/scss/mixins/_box-shadow.scss 10:9 box-shadow() ../../../bootstrap/scss/forms/_form-control.scss 40:7 @import bootstrap/scss/_forms.scss 3:9 @import - 19:9 root stylesheet WARNING: The keyword 'none' must be used as a single argument. ../../../bootstrap/scss/mixins/_box-shadow.scss 10:9 box-shadow() ../../../bootstrap/scss/forms/_form-select.scss 32:7 @import bootstrap/scss/_forms.scss 4:9 @import - 19:9 root stylesheet io: 3 on [ { type: 2, nsp: '/', id: 12, data: [ 'meta.rooms.leaveCurrent', null ] } ] 2.10.184.192 - - [23/May/2025:15:42:55 +0000] "GET /api/admin/advanced/logs?_=1748014516470 HTTP/1.1" 200 - "https://forum.xxx.com/admin/advanced/events" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"
-
For new users the verification email should be sent during user creation here put some console.logs there to see if the email is in the
data
object. The difference is the template used.User.create
uses thewelcome
template and manual verification uses theverify-email
template but otherwise the email sending logic is the same. -
Thanks, I'll check. Just to be sure: my issue is specific to welcome and verify-email emails. For instance, password reset emails work fine. So the basic email sending logic works.