我有一个代码定义为
Parse.Cloud.define("mailgunSendMail", function(request, response) {
var Mailgun = require('mailgun');
Mailgun.initialize('photoshare.com', 'APPKey');
Mailgun.sendEmail({
to: "[email protected] /cdn-cgi/l/email-protection",
from: "[email protected] /cdn-cgi/l/email-protection",
subject: "Hello from Cloud Code!",
text: "Using Parse and Mailgun is great!",
attachment:"ZXhhbXBsZSBmaWxl"
}, {
success: function(httpResponse) {
console.log(httpResponse);
response.success("Email sent!");
},
error: function(httpResponse) {
console.error(httpResponse);
response.error("Uh oh, something went wrong");
}
});
});
邮件发送成功,收件人收到邮件,但附件丢失。如何以数据形式发送附件?
根据解析,目前无法在电子邮件中发送附件。检查此链接 https://www.parse.com/questions/sending-an-attachment-using-parsecom-cloudcode-and-mailgun
但是,如果您可以像这样将图像文件包含在 HTML 代码中(如果这满足您的需求)。
html: '<html><body style="text-align:center;"><img border="0" src="http://files.parse.com/6ffa6b80-d0eb-401f-b663-22d4a16df004/bfed9ac4-058c-41fc-a0f1-fb6155572c12-ad77a082-453f-42f7-94ef-40c3f3e885e6.png" alt="Pulpit rock" width="300" height="150"></body></html>'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)