我已经在mailgun上创建了一个帐户,并且我的域具有所需的所有dns设置。 但是,当我使用nodemailer发送电子邮件时,它没有给我任何错误,并且我也什么也没有收到。
那是我的Nodemailer运输者:
class Mail {
constructor() {
this.transporter = nodemailer.createTransport(
mailgunTransporter({ auth: { ...mailConfig.auth } })
);
this.configureTemplates();
}
// TO DO
configureTemplates() {}
// Message object -> All the data expected from the template
sendEmail(message) {
return this.transporter.sendMail(
{
...mailConfig.default,...message,},(err,info) => {
if (err) return console.log('error',err);
return console.log('info',info);
}
);
}
}
配置:
export default {
auth: {
api_key: process.env.MAILGUN_actIVE_API_KEY,domain: process.env.MAILGUN_DOMAIN,default: {
from: 'laurabeatriserafim@gmail.com',};
要查看更多详细信息的我的仓库:https://github.com/LauraBeatris/gympoint