在阅读了定时发邮件的blog后,我想要定期给现有的注册用户发送一些功能介绍的邮件。我想使用云引擎的在线函数测试邮件发送的功能。
const AV = require("leancloud-storage");
const sgMail = require("@sendgrid/mail");
sgMail.setApiKey(
"" // 你的 SendGrid API Key
);
const msg = {
to: 'test@email.com', // Change to your recipient
from: 'test@sendgrid.com', // Change to your verified sender
subject: 'Sending with SendGrid is Fun',
text: 'and easy to do anywhere, even with Node.js',
html: '<strong>and easy to do anywhere, even with Node.js</strong>',
}
sgMail
.send(msg)
.then((resp) => {
return resp;
})
.catch((error) => {
return error;
})
但是因为需要引入@sendgrid/mail
,运行时报错。Cannot find module '@sendgrid/mail' [500 POST /functions/emailTest]
。请问在线编辑是无法引入第三方包么?只可以本地编写然后部署么?