-
-
Save heshamelmasry77/5b03564682861da14de0770208813242 to your computer and use it in GitHub Desktop.
After searching for more than 6 hours trying to understand what is zoho's mail problem to send emails! | |
After i red lots lots of there answer with no helpul solution i found the issue was that you need to have the ``` sender ``` option | |
in your nodemailer option same like email with same sender name and sender email. like this : ``` from: '"senderNameSameLikeTheZohoOne" <[email protected]>',``` | |
my config : | |
``` | |
const transporter = nodemailer.createTransport({ | |
service:'Zoho', | |
host: 'smtp.zoho.com', | |
port: 465, | |
secure: true, // use SSL | |
auth: { | |
user: `${process.env.EMAIL_ADDRESS}`, | |
pass: `${process.env.EMAIL_PASSWORD}` | |
}, | |
}); | |
``` | |
const mailOptions = { | |
from: '"senderNameSameLikeTheZohoOne" <[email protected]>', | |
to: `${user.email}`, | |
subject: '', | |
text:'' | |
, | |
}; | |
``` | |
``` | |
transporter.sendMail(mailOptions, (err, response) => { | |
if (err) { | |
console.error('there was an error: ', err); | |
res.status(401).json(err); | |
} else { | |
// console.log('here is the res: ', response); | |
res.status(200).json('recovery email sent'); | |
} | |
}); | |
``` |
@chege-kimaru yeh! I created an app password and it worked!
i set up an app specific password but everytime i submit i get this same error
Error: Message failed: 553 Relaying disallowed as @
2021-08-07T11:22:25.671011+00:00 app[web.1]: at SMTPConnection._formatError (/app/node_modules/nodemailer/lib/smtp-connection/index.js:774:19)
2021-08-07T11:22:25.671012+00:00 app[web.1]: at SMTPConnection._actionSMTPStream (/app/node_modules/nodemailer/lib/smtp-connection/index.js:1656:34)
2021-08-07T11:22:25.671013+00:00 app[web.1]: at SMTPConnection. (/app/node_modules/nodemailer/lib/smtp-connection/index.js:1141:22)
2021-08-07T11:22:25.671014+00:00 app[web.1]: at SMTPConnection._processResponse (/app/node_modules/nodemailer/lib/smtp-connection/index.js:937:20)
2021-08-07T11:22:25.671014+00:00 app[web.1]: at SMTPConnection._onData (/app/node_modules/nodemailer/lib/smtp-connection/index.js:739:14)
2021-08-07T11:22:25.671028+00:00 app[web.1]: at TLSSocket.SMTPConnection._onSocketData (/app/node_modules/nodemailer/lib/smtp-connection/index.js:189:44)
2021-08-07T11:22:25.671030+00:00 app[web.1]: at TLSSocket.emit (events.js:400:28)
2021-08-07T11:22:25.671030+00:00 app[web.1]: at addChunk (internal/streams/readable.js:290:12)
2021-08-07T11:22:25.671030+00:00 app[web.1]: at readableAddChunk (internal/streams/readable.js:265:9)
2021-08-07T11:22:25.671031+00:00 app[web.1]: at TLSSocket.Readable.push (internal/streams/readable.js:204:10)
2021-08-07T11:22:25.671031+00:00 app[web.1]: at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23) {
2021-08-07T11:22:25.671032+00:00 app[web.1]: code: 'EMESSAGE',
2021-08-07T11:22:25.671032+00:00 app[web.1]: response: '553 Relaying disallowed as @',
2021-08-07T11:22:25.671033+00:00 app[web.1]: responseCode: 553,
2021-08-07T11:22:25.671033+00:00 app[web.1]: command: 'DATA'
2021-08-07T11:22:25.671034+00:00 app[web.1]: }
Thank you, man!
thanks a lot, helped me getting forward with my project.
I followed this and still got the Authentication Error. I solved this by setting an application password on Zoho as directed in this guide.