Gmail 中的 mailto 链接

发布于 2024-10-12 14:32:59 字数 472 浏览 3 评论 0原文

我在使用 Gmail 的网络应用程序时遇到了问题。由于某种原因,当我尝试将正文添加到链接中时,mailto 链接不起作用。只要 & 链接就可以正常工作。不使用主体分隔符。

例如:

href="mailto:?subject=test&body=this is a test" - 不起作用

href="mailto:?subject=testbody=this is a test" - 确实有效,但显然,它不会产生所需的结果,因为一切都进入主题。

我运行的是 Vista 64 位,并且尝试过 FF、Chrome 和 IE。另外,我还注意到 Gmail 帐户和 Google Apps 帐户中 Gmail 呈现邮件的方式有所不同。

当我在 iPhone 上查看同一封电子邮件时Outlook 一切似乎都运行良好。

任何帮助将不胜感激。

I've encountered a problem with Gmail's web application. For some reason, the mailto links doesn't work when I try to add the body into the link. The links works fine as long as the & separator for the body is not used.

For example:

href="mailto:?subject=test&body=this is a test" - Doesn't work

href="mailto:?subject=testbody=this is a test" - Does work but, obviously, it doesn't generate the desired result as everything goes to the subject.

I am running Vista 64bit and I've tried FF, Chrome and IE. Also, I've noticed a difference between how Gmail renders my mail in my Gmail account and Google Apps account.

When i view the same email on my iPhone & Outlook everything seems to work fine.

Any help will be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

九八野马 2024-10-19 14:32:59

我可以使用完整的 url 将所有内容填充到 Gmail 界面上:

https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&[email protected]&subject=MISSED%20CALL%20EZTRADER&body=Hello%2C%0A%0AI%20tried%20contacting%20you%20today%20but%20you%20seem%20to%20have%20missed%20my%20call.%20%0A%0APlease%20return%20my%20call%20as%20soon%20as%20you%E2%80%99re%20available.%20%0A%0AIn%20any%20case%2C%20I%20will%20try%20ringing%20you%20at%20a%20later%20time.%0A%0A%0ATy%2C%0A%0A%0A%0A

I can get everything to populate on the gmail interface using their full url:

https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&[email protected]&subject=MISSED%20CALL%20EZTRADER&body=Hello%2C%0A%0AI%20tried%20contacting%20you%20today%20but%20you%20seem%20to%20have%20missed%20my%20call.%20%0A%0APlease%20return%20my%20call%20as%20soon%20as%20you%E2%80%99re%20available.%20%0A%0AIn%20any%20case%2C%20I%20will%20try%20ringing%20you%20at%20a%20later%20time.%0A%0A%0ATy%2C%0A%0A%0A%0A
夏花。依旧 2024-10-19 14:32:59

老兄,即使我没有编码“&”,但是我替换了以下字符,然后传递电子邮件正文并接受 mailto,它确实对我有用。希望这能给你带来一些想法。

body = body.replaceAll("\\\\", "%5C");
body = body.replaceAll(" ", "%20");
body = body.replaceAll("\r", "%0D");
body = body.replaceAll("\n", "%0A");
body = body.replaceAll("\t", "%09");

dude , even if I didn't encoding '&', however I replace followings characters, and then pass the email body and subject to mailto, it does work for me. Hope this may brings you some ideas.

body = body.replaceAll("\\\\", "%5C");
body = body.replaceAll(" ", "%20");
body = body.replaceAll("\r", "%0D");
body = body.replaceAll("\n", "%0A");
body = body.replaceAll("\t", "%09");
找个人就嫁了吧 2024-10-19 14:32:59

尝试 href="mailto:?subject=test&body=this+is+a+test"

Try href="mailto:?subject=test&body=this+is+a+test"

辞别 2024-10-19 14:32:59

在 Firefox 19 中测试 - 工作正常。
在 Chrome 中,您需要安装扩展才能使其正常工作。

我测试的页面 - https://dl.dropbox.com/u/60854445/mail。 html
Chrome 扩展程序 - https://chrome.google.com/webstore/detail /mailto-for-gmail/dgkkmcknielgdhebimdnfahpipajcpjn/

也许他们已经修复了它。

Tested in Firefox 19 - working.
In Chrome you need to install an extension to get it working.

The page I tested - https://dl.dropbox.com/u/60854445/mail.html
Chrome extension - https://chrome.google.com/webstore/detail/mailto-for-gmail/dgkkmcknielgdhebimdnfahpipajcpjn/

Maybe they have fixed it.

如此安好 2024-10-19 14:32:59
try this
<a href="mailto:[email protected]?subject=SweetWords&body=Please send me a copy of your new program!">Email Me</a>
try this
<a href="mailto:[email protected]?subject=SweetWords&body=Please send me a copy of your new program!">Email Me</a>
把回忆走一遍 2024-10-19 14:32:59

考虑将空格替换为 %20。
另外,格式问题是什么?或者更清晰地了解一切会有所帮助。您说“mailto 链接不起作用”和“Gmail 在我的 Gmail 帐户和 Google Apps 帐户中呈现我的邮件”。是否发送,如果同时发送,具体区别是什么。

Consider swapping the spaces for %20.
Also, what is the formatting problem? Or better clarity in all would be helpful. you said "the mailto links doesn't work" and "Gmail renders my mail in my Gmail account and Google Apps account". Is it sending it or not, and if it's sending to both what specifically is the difference.

记忆で 2024-10-19 14:32:59

我一直在努力找出为什么 &subject= 无法在 Gmailhref 中使用。


所以我找到了这个 &su= 来使 subject 工作。

参见下面的示例:

href="https://mail.google.com/mail/?view=cm&fs=1&tf=1&to={{[email protected]}}&su=Subject&body=Body%20Text"

%20 - space

%0A - new line

I was struggling to find out why &subject= doesn't work in href for Gmail.


So I found this &su= to make subject work.

See example below:

href="https://mail.google.com/mail/?view=cm&fs=1&tf=1&to={{[email protected]}}&su=Subject&body=Body%20Text"

%20 - space

%0A - new line
顾冷 2024-10-19 14:32:59

正如您在 RFC 2368 中看到的,这是根本不可能的:

特殊的 hname“body”表示关联的 hvalue 是消息的正文。 “body”hname 应包含消息的第一个文本/纯正文部分的内容。 mailto URL 主要用于生成实际上是自动处理内容的短文本消息(例如邮件列表的“订阅”消息),而不是一般的 MIME 正文。

As you can see in RFC 2368, this is not possible at all:

The special hname "body" indicates that the associated hvalue is the body of the message. The "body" hname should contain the content for the first text/plain body part of the message. The mailto URL is primarily intended for generation of short text messages that are actually the content of automatic processing (such as "subscribe" messages for mailing lists), not general MIME bodies.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文