我正在制作一個基本的電子郵件應用程式,用戶可以向他們喜歡的人發送電子郵件。我希望能夠向用戶指定的電子郵件地址發送電子郵件。我不能使用nodemailer,因為它需要密碼和user.id,而我不想向用戶索取密碼。
我已經在Google上搜索了兩天,我所能找到的只是如何向自己而不是向用戶生成的輸入發送電子郵件。
如果有人能給我指出正確的方向,那就太好了。
謝謝!
uj5u.com熱心網友回復:
Nodemailer有一個sendmail傳輸,允許你在沒有任何認證的情況下發送郵件。
let transporter = nodemailer.createTransport( {
sendmail: true,
newline: 'unix',
path: '/usr/sbin/sendmail'.
});
transporter.sendMail({
from: '[email protected]'。
to: '[email protected]'。
subject: 'Message',
text: 'I hope this message gets delivered!'.
}, (err, info) => {
console.log(info.envelope)。
console.log(info.messageId)。
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/313430.html
標籤:
