cc的SendGrid不能在Azure移动应用程序中工作
只有下面的语法似乎在Azure移动应用程序中工作,这里解释https://azure.microsoft.com/en-us/documentation/articles/store-sendgrid-mobile-services-send-email-scripts/#comment- 2539027195
sendgrid.send({to:' email-address ',from:' from-address ',subject:'New to-do item',text:'一个新的待办事项被添加:'+ item.text},函数(成功,消息){if(!success){console.error(message);}});
从上面可以看出,callback函数传递了成功参数,而GitHub( https://github.com/sendgrid/sendgrid-nodejs )中的node.js模块却有错误参数。 所以看起来Azure移动服务不是使用相同的模块或版本,也有一些断开连接。
sendgrid.send(email,function(err,message){if(err){console.error(message);}});
从Azure手机论坛的post:
由于移动服务中SendGrid的默认版本是“0.2.4”,远远低于最新版本。
有两种方法可以尝试更新移动服务中的sendgrid版本:
1,login您的移动服务的kudu控制台网站,利用网站上的cmdlet在线修改您的移动服务应用程序的package.json
文件,例如:
"sendgrid":"^2.0.0",
在“依赖关系”下closures。 然后在cmdlet中运行命令npm update
来更新移动服务中的sendgrid sdk。 Kudu控制台站点URL应该是https://<your_mobile_service_name>.scm.azure-mobile.net/DebugConsole
2,你可以参考https://azure.microsoft.com/en-us/documentation/articles/mobile-services-store-scripts-source-control/#use-npm来为你自己部署sendgrid sdk,使用
var sendgrid = require('sendgrid')('YOUR_SENDGRID_API_KEY');
在你的代码中实现sendgrid。
- 如何使用AMQP在“PeekLock”模式下从Azure服务总线队列获取消息?
- node.js http和bingsearchapi
- 在Windows Azure上使用Socket.io扩展Node.js
- 在Azure上的多个实例之间维护Node.js会话
- Azure上的Node.js和HBase(HDInsight)
- Azure上的Npm SELF_SIGNED_CERT_IN_CHAIN
- 运行在Azure上的express.js中的multipart / form-data错误
- 从自定义node.js API中检索Azure Blob
- 无法用sequelize连接到SQL Azure数据库,但本地主机上的SQL Server工作正常