简体   繁体   English

如何使用 JavaScript 将签名添加到 Outlook email 中?

[英]How can I add a signature into an Outlook email with JavaScript mailto?

I am using JavaScript mailto function to fill an email body with custom text.我正在使用 JavaScript mailto function 用自定义文本填充 email 正文。

I can add text to the email but the signature doesn't show up.我可以向 email 添加文本,但没有显示签名。

Is there any way to send a custom signature with an image using mail-to function?有没有办法使用 mail-to function 发送带有图像的自定义签名? Or is there any way to insert an HTML image in the body when using the mail-to function?或者在使用邮件到 function 时,有什么方法可以在正文中插入 HTML 图像?

Sample code:示例代码:

var message = "text of message";                
var mailLInk = "mailto:sam@example.com?subject=subject&body=" + message;        
document.location.href = mailLink;

Section 2 of RFC 2368 says that the body field is supposed to be in text/plain format, so you can't do HTML. RFC 2368的第 2 节说body字段应该是text/plain格式,所以你不能做 HTML。

However even if you use plain text it's possible that some modern mail clients would render the resulting link as a clickable link anyway, though.但是,即使您使用纯文本,一些现代邮件客户端也可能会将生成的链接呈现为可点击的链接。

No, that information is stored in the outlook profile.不,该信息存储在 outlook 配置文件中。 Its up to Outlook (or some setting) on how to deal with the URL.如何处理 URL 取决于 Outlook(或某些设置)。

currently there is no way to send an html, because only plain text is accepted, and I can give you some tips why not to use mailto to send email:目前没有办法发送 html,因为只接受纯文本,我可以给你一些提示,为什么不使用 mailto 发送 email:

Disadvantages of mailto in HTML HTML中mailto的缺点

  1. Mail address can be read by spam bots垃圾邮件机器人可以读取邮件地址
  2. Mailto only works if visitor have configured mail client Mailto 仅在访问者已配置邮件客户端时才有效
  3. HTML mailto screams "This site is developed by begginer" HTML mailto 尖叫“这个网站是由初学者开发的”

There is only one advantage and its easy to create and implement into web site.只有一个优点,它易于创建和实施到 web 站点。 But if you want to use it just encode your mail address so it can't be read with spam bots.但是,如果您想使用它,只需对您的邮件地址进行编码,这样垃圾邮件机器人就无法读取它。

But if you want to add footer in your mail message, then just in your body parameter add %0A, %0A is new line and your cursor will blink there so ?body=%0AThen your footer text will give you footer in email.但是如果你想在你的邮件消息中添加页脚,那么只需在你的正文参数中添加 %0A,%0A 是新行,你的 cursor 会在那里闪烁,所以?body=%0AThen your footer text会给你 email 的页脚。

:) :)

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

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