本文介绍了Mailgun:使用解析云代码发送图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个定义为

Parse.Cloud.define("mailgunSendMail", function(request, response) {

               var Mailgun = require('mailgun');
               Mailgun.initialize('photoshare.com', 'APPKey');

               Mailgun.sendEmail({
                                 to: "toTestUser@mail.com",
                                 from: "fromTestUser@mail.com",
                                 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");
                                 }
                                 });
               });

邮件已成功发送,收件人收到了邮件,但附件丢失.如何以数据形式发送附件?

Mail was sent successfully and recipient got the mail but the attachment is missing. How can i send attachment in the form of data?

推荐答案

根据解析,目前无法在电子邮件中发送附件. 选中此链接

According to parse, at this point there is no way to send attachments in an email. Check this link

但是,如果您可以将图像文件包含在HTML代码中,则可以满足您的需要.

However, if you can include your image file in your HTML code like this if this serves your needs.

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>'

这篇关于Mailgun:使用解析云代码发送图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 04:12
查看更多