How to get the status of a message sent with nodemailer that never reach the recipient?

Refresh

April 2019

Views

225 time

1

I am trying to use nodemailer to send emails via a mail server that I own in JustHost. I am using the SMTP settings provided by the hosting.

let transporter = nodemailer.createTransport({
    host: 'mail.wegocuba.com',
    port: 465,
    secure: true,
    auth: {
        user: PROVIDERS.wegocuba.user,
        pass: PROVIDERS.wegocuba.pass 
    },
    tls: {
        rejectUnauthorized: false
    }
});

let configureMailer = (text, to) => {
    return {
        from: '"USER" <[email protected]>',
        to: to, // list of receivers
        subject: 'Hello world',
        text: text,
    };
};
mySendMail = (to, text) => {
    let sender = configureMailer(text, to);
    transporter.sendMail(sender, (error, info) => {
        if (error) {
            return console.log(error);
        }
        console.log(info.messageId);
    });
},

When I call the mySendMail(to, text) function, the server respond without problems.

{  accepted: [ '[email protected]' ],
   rejected: [],
   envelopeTime: 107,
   messageTime: 73,
   messageSize: 288,
   response: '250 OK id=1eUGz4-003LtQ-RK',
   envelope: { from: '[email protected]', to: [ '[email protected]' ] },
   messageId: '<[email protected]>' }

But the email never reach the recipient, neither appears as sent in the SENT folder. How can I know what really is happening in the mail server?

Abs

0 answers