电子邮件中的流星href

我正在尝试发送一封带有href内容的电子邮件。

const link= document.createElement("a");
link.href = window.location.href;

emailDetails.body = "Here is an href: \r\n" + link;

Meteor.call("sendEmail",emailDetails.to,email,emailDetails.subject,emailDetails.body);

我的电子邮件方法是

sendEmail: function (to,from,subject,html) {
check([to,text],[String]);

this.unblock();

Email.send({
  to: to,from: from,subject: subject,html: html
});

但是我没有运气。实际电子邮件的来源确实显示了锚标记,但内部没有href。

我也尝试将html放入模板中,然后使用

编译模板
SRR.compileTemplate

,并将结果作为我的电子邮件正文传递。但这也不起作用。关于如何实现这一目标的任何想法?

gansinimabi 回答:电子邮件中的流星href

原来,Gmail不会呈现锚标记,但是Outlook会呈现。因此,电子邮件客户端如何处理嵌入式html是一个问题。

,

实际上有可能,只需使用普通标签即可;而不是document.createElement("a")

smtp = {
    username: "server@gentlenode.com",password: "3eeP1gtizk5eziohfervU",server: "smtp.gmail.com",port: 587
  };

  process.env.MAIL_URL =
    "smtp://" +
    encodeURIComponent(smtp.username) +
    ":" +
    encodeURIComponent(smtp.password) +
    "@" +
    encodeURIComponent(smtp.server) +
    ":" +
    smtp.port;

  Email.send({
    to: "duckduck@quack.com",from: "mew2@gmail.com",subject: "hello",html: `<p><strong>This will render as bold text</strong>,but this will not.</p> Also,You can direct users to <a href="duckduckgo.com">duckduckgo</a>`
  });

https://themeteorchef.com/tutorials/using-the-email-package

本文链接:https://www.f2er.com/3106275.html

大家都在问