question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Emails are not being sent

See original GitHub issue

Hi, I’m having the problem that the app is not sending the email. May be a problem with the template engine? Above I write down the codes I’m using and the console output. I’d in providing any further details.

mailSender function has:

const transporter = nodemailer.createTransport({
    host: 'smtp.ethereal.email',
    port: 587,
    auth: {
        user: `${user}`,
        pass: `${password}`
    }
});

mailOptions.to= destinatioon
mailOptions.from= user;

 const email = new Email({
        message: mailOptions,
        transport: transporter,
        views: {
            root: '../templates/email',
            options: {
                extension: 'ejs'
            }
        }
    });

    email.send({
            template: 'resetPassword',
            locals: templateParamsArray
        })
        .then(console.log)
        .catch(console.error);

In app.js I have:

server.engine('html', require('ejs').renderFile);
server.set('view engine', 'ejs');

The templates directory: image

The templates:

html.ejs:

<tr>
    <td align="left" style="padding:0px 40px 40px 40px"><p
                style="color:#262626; font-size:32px; text-align:left; font-family: Verdana, Geneva, sans-serif">
            Hello <%= name %></p>
        <br style="color:#000000; font-size:16px; text-align:left; font-family: Verdana, Geneva, sans-serif; line-height:22px ">
        You requested for a password reset.</br>
        Please complete your password reset by clicking the below link</br>
        <a href="<%= token %>">
            <%= token %>
        </a> <br/>
        <br/>
        </p></td>

</tr>

subject.ejs:

=Password Reset

Console output: { envelope: server_1 | { from: ‘abc@ethereal.email’, server_1 | to: [ ‘ms@provider.com’ ] }, server_1 | messageId: ‘themessageid@ethereal.email’, server_1 | message: ‘{“to”:[{“address”:“ms@provider.com”,“name”:“”}],“from”:{“address”:“abc@ethereal.email”,“name”:“”},“attachments”:[],“headers”:{},“messageId”:“abc@ethereal.email”}’, server_1 | originalMessage: server_1 | { to: ’ ms@provider.com’, server_1 | from: ‘ee4p6d6bz7p5fp6w@ethereal.email’, server_1 | attachments: [] } }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
niftylettucecommented, Jun 8, 2018

NODE_ENV=production flag being used? Or you can explicitly pass option send: true.

0reactions
matiassequeiracommented, Jul 31, 2018

Yes, it’s solved. Thank you

El El mar, 31 jul. 2018 a las 20:12, niftylettuce notifications@github.com escribió:

I’m assuming you resolved this, but if not let me know

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/niftylettuce/email-templates/issues/305#issuecomment-409397488, or mute the thread https://github.com/notifications/unsubscribe-auth/ANsDjaxWfiqA0SWpl47lF7xPDnhxx612ks5uMORfgaJpZM4Ugn3S .

– Ing. Matías Sequeira

Cel: +54 9 345 433 3664 Skype: matias-sequeira@hotmail.com Linkedin: linkedin.com/in/sequeiram/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is My E-mail Not Getting to the Recipient? - Computer Hope
The most severe reason e-mails are not delivered to a recipient is because a mail server could be blacklisted. When a mail server...
Read more >
An email I sent was delayed or didn't arrive - Gmail Help
The email is taking a long time to send · Make sure you're connected to Wi-Fi or mobile data. If you're on a...
Read more >
Email not sending - Things to do to solve sending issues
The email authentication failed. If you're using an SMTP authentication like SSL, check again your username and password. · There's a port problem....
Read more >
Unable to Send Email? Check These 5 Things Right Now
Unable to Send Email? · 1. Bad Passwords · 2. Network Connection Errors · 3. ISP Blocking Port 25 · 4. SMTP Authentication...
Read more >
Why Are My Emails Not Being Delivered? - Alchemer Help
A soft bounce might occur because the recipient's mailbox is full, the server is down or swamped with messages, or the message is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found