Closed sonnyk22 closed 6 years ago
You pass it as the transport
option https://github.com/niftylettuce/email-templates/blob/master/src/index.js#L83-L86.
Perfect! Thank you!
I more quick question.
I've gotten everything working nicely using the email-templates v5.0
as seen in the code below, but every time an email gets send (I do received them in my inbox), the browser opens up and shows me the output of my template with all the fields set, and the text version
of the same template. Is there a setting to turn this off in Development
and Production
?
Thank you!
const config = {
views: {
root: root,
options: {
extension: 'hbs'
}
},
message: {
from: constants.EmailFrom
},
send: true,
transport: {
host: emailCreds.host,
port: emailCreds.port,
secure: emailCreds.secure,
auth: {
user: emailCreds.auth.user,
pass: emailCreds.auth.pass
},
tls: {
rejectUnauthorized: false
}
}
}
const email = new Email(config);
email
.send({
template: constants.TplEmailConfirmation,
message: {
to: 'email@somthing.net'
},
locals: {
name: 'me'
}
})
.then(() => {
// code
})
.catch((err) => {
// code
});
The option is preview
, see
https://github.com/niftylettuce/email-templates/blob/master/src/index.js#L60.
It will automatically be turned off in non-development environments.
On Wed, Sep 12, 2018, 10:11 PM Sonny K notifications@github.com wrote:
I more quick question.
I've gotten everything working nicely using the email-templates v5.0as seen in the code below, but every time an email gets send (I do received them in my inbox), the browser opens up and shows me the output of my template with all the fields set, and the text version of the same template. Is there a setting to turn this off in Developmentand Production ?
Thank you!
const config = { views: { root: root, options: { extension: 'hbs' } }, message: { from: constants.EmailFrom }, send: true, transport: { host: emailCreds.host, port: emailCreds.port, secure: emailCreds.secure, auth: { user: emailCreds.auth.user, pass: emailCreds.auth.pass }, tls: { rejectUnauthorized: false } } }
const email = new Email(config);
email .send({ template: constants.TplEmailConfirmation, message: { to: 'email@somthing.net' }, locals: { name: 'me' } }) .then(() => { // code }) .catch((err) => { // code });
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/niftylettuce/email-templates/issues/321#issuecomment-420869239, or mute the thread https://github.com/notifications/unsubscribe-auth/AAf7hce7U2BG56sAz_siTfm3vMEcxwlMks5uacz_gaJpZM4WmAvt .
That was it! Thank you!
Thank you for this great library.
My app works fine using the
email-templates v2.7.1
. Now, I want to use the latest version. I like the fact that in the latest version, I can send email with our requiringnodemailer
. However, I am not sure where I can pass-in my transport information as example below.Thank you!