HTML 电子邮件中的转发链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7576844/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Forward link in HTML email
提问by Marty
I need to create a "forward to friend" link in a HTML email that will mimic the forward button on the mail client (ie launch a new window with a pre-filled body), is this possible?
我需要在 HTML 电子邮件中创建一个“转发给朋友”链接,该链接将模仿邮件客户端上的转发按钮(即启动一个带有预填充正文的新窗口),这可能吗?
ie:
IE:
<a href="forward-action">Forward this email to a friend</a>
<a href="forward-action">Forward this email to a friend</a>
If not, what's a simple approach to achieve an as similar as possible result?
如果没有,实现尽可能相似结果的简单方法是什么?
ps. I'm aware this is pretty much pointless functionality, it's a request from client.
附:我知道这几乎是毫无意义的功能,这是来自客户的请求。
采纳答案by Jason Gennaro
I wonder if your client would go for this:
我想知道您的客户是否会这样做:
create a jazzy Forward to a Friendbutton.
that button should open up a page on the client site.
that page should contain an email a friendform.
创建一个爵士般的转发给朋友按钮。
该按钮应该在客户端站点上打开一个页面。
该页面应包含电子邮件好友表单。
Much easier to accomplish.
更容易实现。
回答by Sean Vieira
You cannot imitate or initiate the forward action in any mail client (web or desktop) currently on the market today. You have several other options available though:
您无法在当前市场上的任何邮件客户端(Web 或桌面)中模仿或启动转发操作。不过,您还有其他几种选择:
Offer an online version of your email and include a link to it in your
mailto
tag:<a href="mailto:Enter%20an%20email?subject=Your%20Subject%20Line&body=Thought%20you%20might%20be%20interested%20in%20this%20http://www.yourdomain.com"> Forward to a friend</a>
Include a callout in your email (near the top, preferably) encouraging your recipients to forward the message to their friends.
Include a link to a web form where your recipients can provide other people's email addresses and send these new email addresses copies of the mailing. (The only issue with this one is that the recipient's address book is not available to them easily, which probably hinders sharing - test to know what yourdemographic is like).
提供电子邮件的在线版本,并在
mailto
标签中包含指向它的链接:<a href="mailto:Enter%20an%20email?subject=Your%20Subject%20Line&body=Thought%20you%20might%20be%20interested%20in%20this%20http://www.yourdomain.com"> Forward to a friend</a>
在您的电子邮件中包含一个标注(最好靠近顶部),鼓励您的收件人将消息转发给他们的朋友。
包含一个指向 Web 表单的链接,您的收件人可以在其中提供其他人的电子邮件地址并发送邮件的这些新电子邮件地址副本。(这个唯一的问题是收件人的地址簿不容易被他们使用,这可能会阻碍共享 - 测试以了解您的人口统计数据)。
回答by Peter Olson
No, this is not possible. At least, I really, really, really hope it's not possible.
不,这是不可能的。至少,我真的,真的,真的希望这是不可能的。
Why? Because if it was possible, spammers could put links in e-mails that might cause people to unintentionally forward something. For this reason, forwarding has to be self-instigated by the user with the functionality provided by their e-mail client.
为什么?因为如果可能的话,垃圾邮件发送者可能会在电子邮件中放置链接,这可能会导致人们无意中转发某些内容。因此,转发必须由用户使用其电子邮件客户端提供的功能自行发起。
You can have links that use the mailto
protocol, like this
您可以拥有使用该mailto
协议的链接,如下所示
<a href="mailto:[email protected]">Link</a>
but this probably isn't what you are looking for. All this does is open the compose mail page with the e-mail field filled in (assuming that their default e-mail client is configured to do so).
但这可能不是你要找的。所有这一切都是打开填写电子邮件字段的撰写邮件页面(假设他们的默认电子邮件客户端配置为这样做)。
You could do something like this:
你可以这样做:
<a href="mailto:[email protected]?subject=FW: Email Subject
&body=Body of email text
&[email protected]
&[email protected]">Forward email</a>
And fill out all the fields in the compose mail dialog, but there is nothing you can do that emulates the forwarding functionality.
并填写撰写邮件对话框中的所有字段,但您无法模拟转发功能。
回答by Andrei V
If you can extract from HTML email client Subject and Body of the email then you can do this:
如果您可以从 HTML 电子邮件客户端主题和电子邮件正文中提取,那么您可以执行以下操作:
<a href="mailto:[email protected]?subject=..extracted subject...&body=...extracted body...">Forward</a>
One major minus is your whole URI inside 'a' can not be longer then 1024 characters. Oh and don't forget to URL escape subject and body when composing URI string.
一个主要的缺点是“a”中的整个 URI 不能超过 1024 个字符。哦,不要忘记在组合 URI 字符串时对主题和正文进行 URL 转义。
回答by Kshitij Maurya
Forwarding is not possible.
转发是不可能的。
But I've done some research on the same like as I wanted to promote an event.
但是我已经做了一些研究,就像我想宣传一个活动一样。
I've create this following link,
我创建了以下链接,
<a href="mailto:?&subject=Webinar%20on+Leveraging+Artificial+Intelligence+to+Build+Algorithmic+Trading+Strategies&body=Check%20out%20this%20webinar%20on%20developing%20robust%20quantitative%20trading%20strategies%20using%20AI.%20http%3A//bit.ly/1MqTMzg" target="_blank">Spread the word</a>
Hope it helps!
希望能帮助到你!
回答by Storming Robots
I am not a web developer, but just writing web pages for myself. I have stopped directly putting email addresses into html in order to avoid being captured by bots for spamming purpose or whatever it may be.
我不是网络开发人员,只是为自己编写网页。我已经停止直接将电子邮件地址放入 html 中,以避免被机器人捕获以发送垃圾邮件或其他任何目的。
I wrote a simple js to concat pieces of information together instead:
我写了一个简单的 js 来将信息片段连接在一起:
function ml(name, dom, sub, body) {
var mailname = name + "@";
var nl = "%C2%A0%0A";
var nlcol = "%3A" + nl;
var dom = dom + ".";
var msg = "mai" + "lto:" + mailname + dom + "com" + "?subject=" + sub + "&body=" + body;
window.location.href = msg;
}
in the html:
在html中:
<a onclick="ml('emailName', 'domain Name', 'subject string', 'greeting in content or any text in content')" >
<input type="button" value="Share with a friend">
</a>