I am using a custom email on a custom domain and trying to send emails to clients. On the node side the response shows the email is sent but can't see it on the reciever's input box.
var transporter = nodemailer.createTransport({
host: 'mail.example.com',
port: '587',
secure: true ,
auth: {
user: "[email protected]",
pass: 'password' },
tls: rejectUnauthorized:false ,
}
});
transporter.sendMail(mailOptions,function(error,info){
if (error) return 400;
else {
console.log(info) ;
return 200 ;
}
});
CodePudding user response:
Are you sure this is the code that is able to send messages? There is a {
missing in key tls
.
And try changing the port to 465
(Though it's deprecated)
CodePudding user response:
found out the issue. idk why, but when I added the optional parameter in transporter: name: "www.domain.com" it started working.