我想通过使用Parse.com的JS云云,利用Sendgrid通过电子邮件发送文件。该文件存在,它查询它的权利,它只是不将其连接到电子邮件通过解析云模块通过电子邮件发送文件Sendgird
var theFile = object.get("file")
var sendgrid = require("sendgrid");
sendgrid.initialize("***", "**");
var email = sendgrid.Email({to: ['[email protected]']});
email.setFrom('[email protected]');
email.setSubject('Payroll');
email.setText("This is the payroll file for yesterday \n \n" + theFile.url())
console.log(theFile)
email.addFile(theFile.name(), theFile).then(function(e) {
console.log("In file add");
console.log(e);
console.log("this is filename " + theFile.name());
});
sendgrid.sendEmail(email);
该文件存在,它显示了在我接受以及电子邮件。尽管我仍然可以通过URL获取文件,但我想将其附加到电子邮件中。
好像你的'addFile'方法有错误的签名。请参阅[文档](https://github.com/sendgrid/sendgrid-nodejs#addfile);它只需要一个对象,而不是一个参数列表。 –