当我使用mailto:时,是否可以设置电子邮件的主题/内容?


当前回答

是的,你可以这样做:

mailto: email@host.com?subject=something

其他回答

我把它分成几行,让它更容易读。

<a href="

    mailto:johndoe@gmail.com

    ?subject=My+great+email+to+you

    &body=This+is+an+awesome+email

    &cc=janedoe@gmail.com

    &bcc=billybob@yahoo.com

">Click here to send email!</a>

是的,你可以这样做:

mailto: email@host.com?subject=something

如果你想添加html内容到你的电子邮件,url编码你的html代码的消息体,并包括在你的mailto链接代码,但问题是你不能设置电子邮件的类型从明文到html,客户端使用链接需要他们的邮件客户端默认发送html电子邮件。如果你想测试的话,这里有一个简单的mailto链接的代码,链接中包含一个图像(添加angular风格的url是为了可见性):

<a href="mailto:?body=%3Ca%20href%3D%22{{ scope.url }}%22%3E%3Cimg%20src%3D%22{{ scope.url }}%22%20width%3D%22300%22%20%2F%3E%3C%2Fa%3E">

html标记是url编码的。

<a href="mailto:manish@simplygraphix.com?subject=Feedback for 
webdevelopersnotes.com&body=The Tips and Tricks section is great
&cc=anotheremailaddress@anotherdomain.com
&bcc=onemore@anotherdomain.com">Send me an email</a>

您可以使用此代码设置主题,正文,抄送,密件

mailto:joe@company.com?subject=Your+subject