SMTP Emails are not being sent

Description

I’ve tried to setup email server in SMTP settings with sendgrid and Office 365. In both cases, no emails are being sent to the users. The error logs are included in the thread below.

SendGrid settings

Protocol: smtp
Host: smtp.sendgrid.net
Port: 587
IgnoreTLS: false
Pool: false
Username: APIKEY
Password: APISecret
From Email: testemail

Office 365 settings

Protocol: smtp
Host: smtp.office365.com
Port: 587
IgnoreTLS: false
Pool: false
Username: testemail
Password: XXXXXXXXXXX
From Email: testemail

Server Setup Information

Rocket chat server runs on azure as an app service as a container.

  • Version of Rocket.Chat Server: 4.8.1
  • Operating System: Ubuntu
  • Deployment Method:
  • Number of Running Instances: 1
  • DB Replicaset Oplog: (oplog Enabled)
  • NodeJS Version: v14.18.3
  • MongoDB Version: 5.0.9
  • Firewalls involved:Yes

Any additional Information

Error logs

Exception in defer callback: Error: Invalid login: 535 Authentication failed: Bad username / password     at SMTPConnection._formatError (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)     at SMTPConnection._actionAUTHComplete (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:1536:34)     at SMTPConnection.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:540:26)     at SMTPConnection._processResponse (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:947:20)     at SMTPConnection._onData (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)     at TLSSocket.SMTPConnection._onSocketData (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:189:44)     at TLSSocket.emit (events.js:400:28)     at TLSSocket.emit (domain.js:475:12)     at addChunk (internal/streams/readable.js:293:12)     at readableAddChunk (internal/streams/readable.js:267:9)     at TLSSocket.Readable.push (internal/streams/readable.js:206:10)     at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)     at TLSWrap.callbackTrampoline (internal/async_hooks.js:130:17) {   code: 'EAUTH',   response: '535 Authentication failed: Bad username / password',   responseCode: 535,   command: 'AUTH PLAIN' } 

Restart the server after configuration is complete. It solves the issue.

No, it does not - at least in my case.