简体   繁体   English

如何在Parse云代码中使用Mailgun将长HTML作为电子邮件发送

[英]How to send long html as email using Mailgun in Parse cloud code

I'm able to send emails from Parse cloud code using the below code. 我可以使用以下代码从Parse云代码发送电子邮件。 I'm facing formatting issues when long html templates are involved. 当涉及到较长的html模板时,我面临格式问题。 Is there anyway I can call a html file without having to copy chunks of html code? 无论如何,我可以调用html文件而不用复制大量html代码吗?

If there any website to format the html code, which can be easily copy pasted? 如果有任何网站可以格式化html代码,可以轻松地复制粘贴?

 Mailgun.sendEmail({
  to: email,
  from: "XYZ <hello@xyz.com>",
  subject: "Welcome to XYZ",  
  text: "Hello " + name + ",\n\n Welcome to XYZ!",
  html: "<html> <b> Awesome restaurants around you </html>"
 }, {
  success: function(httpResponse) {
    console.log(httpResponse);
    console.log("Email sent to " + email);
  },
  error: function(httpResponse) {
    console.error(httpResponse);
    console.error("Uh oh, something went wrong");
  }
});

Finally I used this website to convert huge chunks of HTML into Javascript. 最后,我用这个网站将HTML的大块转换成Javascript。

http://htmltojavascript.com/ http://htmltojavascript.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM