1

this is the code I used

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

  Mailgun.sendEmail({
  to: "[email protected]",
  from: "[email protected]",
  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");
  }
});
                   });

I receive the mail but only with the html part - so i can see only the image without the text.. If I remove the html part I receive the text.

how can I combine them? and is there a better way to include image?

Using ios and Parse cloud code.

1
  • This is the recieved mail original view:--33cd9261657a412cb62ef49d3b376c2e Content-Type: text/plain; charset="ascii" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit HIIIIIIIIIIII --33cd9261657a412cb62ef49d3b376c2e Content-Type: text/html; charset="ascii" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit <html><body style="text-align:center;"><img border="0" src="files.parsetfss.com/f07ad0f6-e28d-4d62-83d5-69fadc127bab/…" width="200" height="200" ></body></html> - the text is there somewhere - but i cant see it on gmail...
    – DaNLtR
    Aug 23, 2015 at 13:21

1 Answer 1

1

Text represents the text version of the email, where as HTML represents the HTML version of the email.

In order to view the text, incorporate the text within your html version of the email.

Example:

var textMessage = "some text message";

Mailgun.sendEmail({
  to: "[email protected]",
  from: "[email protected]",
  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");
  }
});

This should place the text message below your image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.