当我尝试通过google函数发送电子邮件时,它会在err之后抛出
{错误:GetAddrInfoReqWrap.onlookup上的getaddrinfo EAI_AGAIN api.sendgrid.com:443 [oncomplete](dns.js:67:26)errno:'EAI_AGAIN',代码:'EAI_AGAIN',系统调用:'getaddrinfo',主机名:“ api.sendgrid.com”,主机:“ api.sendgrid.com”,端口:443}
但是我在本地计算机上尝试了完全相同的代码,所以完全可以正常工作 这是我的功能
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(SENDGRID_API_KEY);
var sendMail = function (templateId, receivers, dynamicData, sender, mailSubject) {
var mailMsg ={
to :receivers[0].email,
from : sender[0].email ,
subject : mailSubject,
templateId : templateId,
dynamic_template_data : dynamicData
}
sgMail.send(mailMsg).then(() => console.log("mail sent"))
.catch(err => console.log(err));
}
提前谢谢!!!!