[英]Is it possible to send an email using sendgrid in Azure without calling context.done?
I am using the azure portal to write an azure function to go through a database and send multiple emails using sendgrid for each database entry. 我正在使用azure门户网站编写azure函数以遍历数据库,并使用sendgrid为每个数据库条目发送多封电子邮件。 I have been able to send one email using sendgrid by placing the following code inside my foreach loop:
通过将以下代码放入我的foreach循环中,我已经能够使用sendgrid发送一封电子邮件:
var message = {
"personalizations": [ { "to": [ { "email": "testto@gmail.com" } ] } ],
from: { email: "testfrom@gmail.com" },
subject: "Azure news",
content: [{
type: 'text/plain',
value: order
}]
};
context.done(null, {message});
The problem is that calling context.done(null,{message}) to send the email using sendgrid ends my function. 问题是,调用context.done(null,{message})使用sendgrid发送电子邮件会终止我的功能。 Which means that I am only able to send one email.
这意味着我只能发送一封电子邮件。
Is it possible to use something other than context.done to send emails using sendgrid so that I can send multiple emails from within the function? 是否可以使用除context.done之外的其他方式使用sendgrid发送电子邮件,以便我可以从该功能内发送多封电子邮件?
我发现您可以使用context.bindings.message(或您为sendgrid命名的任何名称)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.