
193
11
장
이메일 전송
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
를 두 번 호출했습니다. 일반적으로는
res
.
render
를 한 번만 호출하며, 두 번 호
출하더라도 첫 번째 호출 결과만 ...