Last active
August 2, 2023 14:23
-
-
Save heshamelmasry77/5b03564682861da14de0770208813242 to your computer and use it in GitHub Desktop.
Error: Message failed: 553 Relaying disallowed as @ the solution NodeMail Zoho
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} | |
}); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks a lot, helped me getting forward with my project.