1 year ago

#377637

test-img

zitzennuggler

Nodemailer sends emails but they are not received

I am using the nodemailer module to send emails through my gmail account.

The problem i am facing is that they are sent from my account but never received by the other mail.

Whats more confusing to me is that when I send the mail to the same mail as the sender than it works, but that is of course not what I want.

Any one knows how to fix this?

Here is what i tried:

const transporter = nodemailer.createTransport({
    name: "smtp.gmail.com",
    host: "smtp.gmail.com",
    service: 'gmail',
    auth: {
        user: 'email',
        pass: 'pass'
    },
    secure: false,
    logger: true,
    debug: true
});

const mailOptions = {
    from: '...',
    to: '...',
    subject: '...',
    html: '...'
};

transporter.sendMail(mailOptions, function (error, info) {
    if (error) {
        console.log(error);
    } else {
        console.log('Email sent: ' + info.response);
    }
});

No errors and when i look in my mail account it shows that it was sent

javascript

node.js

nodemailer

0 Answers

Your Answer

Accepted video resources