如何从 React.js/Express.js 中的用户输入字段向地址发送电子邮件?
How to send an email to an address from user input feild in React.js/Express.js?
我正在制作一个基本的电子邮件应用程序,用户可以在其中向他们喜欢的任何人发送电子邮件。我希望能够向用户指定的电子邮件地址发送电子邮件。我不能使用 nodemailer,因为它需要密码和 user.id 而且我不想向用户索要密码。
我已经搜索 Google 两天了,我能找到的只是如何向自己发送电子邮件而不是用户生成的输入。
如果有人能指出正确的方向,那就太好了。
谢谢!
Nodemailer 有一个 sendmail 传输,允许您在没有任何身份验证的情况下发送邮件。
let transporter = nodemailer.createTransport({
sendmail: true,
newline: 'unix',
path: '/usr/sbin/sendmail'
});
transporter.sendMail({
from: 'sender@your-domain.com',
to: 'recipient@example.com',
subject: 'Message',
text: 'I hope this message gets delivered!'
}, (err, info) => {
console.log(info.envelope);
console.log(info.messageId);
});
我正在制作一个基本的电子邮件应用程序,用户可以在其中向他们喜欢的任何人发送电子邮件。我希望能够向用户指定的电子邮件地址发送电子邮件。我不能使用 nodemailer,因为它需要密码和 user.id 而且我不想向用户索要密码。
我已经搜索 Google 两天了,我能找到的只是如何向自己发送电子邮件而不是用户生成的输入。
如果有人能指出正确的方向,那就太好了。
谢谢!
Nodemailer 有一个 sendmail 传输,允许您在没有任何身份验证的情况下发送邮件。
let transporter = nodemailer.createTransport({
sendmail: true,
newline: 'unix',
path: '/usr/sbin/sendmail'
});
transporter.sendMail({
from: 'sender@your-domain.com',
to: 'recipient@example.com',
subject: 'Message',
text: 'I hope this message gets delivered!'
}, (err, info) => {
console.log(info.envelope);
console.log(info.messageId);
});