I am currently developing a NodeJS server implementing the nodemailer
package but I am facing issues about mails getting queued but not received.
Something to note is that my domain is registered at OVH and I have an MX Plan with a professional email with my domain name. My server is hosted on DigitalOcean and I can give more information later on if needed.
Here is how I am sending the email:
const transporter = nodemailer.createTransport({
name: 'mydomain.com',
host: ssl0.ovh.net,
port: 465,
secure: true,
auth: {
user: 'mail@mydomain.com',
password: 'mypassword'
}
})
const mailOptions = {
from: {
name: 'My name',
address: 'mail@mydomain.com'
},
to: 'receiver@email.com',
subject: 'New email',
html: some_html_goes_here
}
transported.sendMail(mailOptions, (err, info) => {
if(err) console.log(err)
console.log(info)
})
After sending the email to the recipient this is the response that I get.
{
accepted: [ 'receiver@email.com' ],
rejected: [],
envelopeTime: 222,
messageTime: 57,
messageSize: 22233,
response: '250 2.0.0 Ok: queued as E2D4B1ED09376',
envelope: { from: 'mail@mydomain.com', to: [ 'receiver@email.com' ] },
messageId: '<ebf643b8-858d-18f0-c685-19f6626a4c51@mydomain.com>'
}
I don't know if I am doing something wrong but sometimes the email is received by the recipient and sometimes not.
Thanks to anyone who can help me!
Note: I don't know if it is worth mentioning that but I have a TXT record in my DNS Zone on OVH looking like this: mydomain.com. 0 TXT "v=spf1 include:mx.ovh.com ~all"