Emails are not being sent
See original GitHub issueHi, 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:
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:
- Created 5 years ago
- Comments:6
NODE_ENV=production
flag being used? Or you can explicitly pass optionsend: true
.Yes, it’s solved. Thank you
El El mar, 31 jul. 2018 a las 20:12, niftylettuce notifications@github.com escribió:
– Ing. Matías Sequeira
Cel: +54 9 345 433 3664 Skype: matias-sequeira@hotmail.com Linkedin: linkedin.com/in/sequeiram/