
发送邮件
|
113
name: name,
email: email,
}
res.render('email/cart-thank-you', { layout: null, cart: cart },
(err,html) => {
console.log('rendered email: ', html)
if(err) console.log('error in email template')
mailTransport.sendMail({
from: '"Meadowlark Travel": info@meadowlarktravel.com',
to: cart.billing.email,
subject: 'Thank You for Book your Trip with Meadowlark Travel',
html: html,
text: htmlToFormattedText(html),
})
.then(info => {
console.log('sent! ', info)
res.render('cart-thank-you', { cart: cart })
})
.catch(err => {
console.error('Unable to send confirmation: ' + err.message)
})
}
)
})
注意,我们调用了
res.render
两次。正常情况下 ...