Mailgun:从 Parse 发送图像(HTML)和文本仅显示 html

Mailgun : sending image(HTML) and text from Parse shows only html

这是我使用的代码

  Parse.Cloud.define("blendedBookMailToUser", function(request, response) {
           var Mailgun = require('mailgun');
           Mailgun.initialize('SandBoxCode', 'Key');

  Mailgun.sendEmail({
  to: "someone@gmail.com",
  from: "me@me.com",
  subject: "Session Booked",
  text: "HIIIIIIIIIIII" ,
  html:'<html><body style="text-align:center;"><img border="0" src="' + request.params.qrUrlKey + '" width="200" height="200" ></body></html>',

}, {
  success: function(httpResponse) {
    console.log(httpResponse);
    response.success("Email sent!");
  },
  error: function(httpResponse) {
    console.error(httpResponse);
    response.error("Uh oh, something went wrong");
  }
});
                   });

我收到了邮件,但只有 html 部分 - 所以我只能看到没有文字的图片.. 如果我删除 html 部分,我会收到文本。

如何组合它们?有没有更好的方法来包含图片?

使用 ios 和解析云代码。

Text 表示电子邮件的文本版本,其中 HTML 表示电子邮件的 HTML 版本。

为了查看文本,请将文本合并到您的 html 版本的电子邮件中。

示例:

var textMessage = "some text message";

Mailgun.sendEmail({
  to: "someone@gmail.com",
  from: "me@me.com",
  subject: "Session Booked",
  text: textMessage ,
  html:'<html><body style="text-align:center;"><img border="0" src="' + request.params.qrUrlKey + '" width="200" height="200" >' + textMessage + '</body></html>',

}, {
  success: function(httpResponse) {
    console.log(httpResponse);
    response.success("Email sent!");
  },
  error: function(httpResponse) {
    console.error(httpResponse);
    response.error("Uh oh, something went wrong");
  }
});

这应该将文本消息放在您的图片下方。