HTML:“发送给朋友”链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3326459/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:53:17  来源:igfitidea点击:

HTML: "send to a friend" link

htmlemailmailto

提问by aneuryzm

I need to add a "Send to a friend" link to my website.

我需要在我的网站上添加一个“发送给朋友”链接。

When a user clicks on it, their e-mail software should open and the e-mail should be already filled.

当用户点击它时,他们的电子邮件软件应该打开并且电子邮件应该已经填写。

Subject: Website Name Body: Link to website, short description

主题:网站名称正文:网站链接,简短说明

is that possible ? thanks

那可能吗 ?谢谢

回答by Tobiasopdenbrouw

<a href="mailto:[email protected]?subject=Website Name&body=Link to website, short description">Send me an email</a>

Is one way.

是一种方式。

回答by Luc

Using protocol mailto and GET parameters is correct, but you also have to use the urlencoded version for strings:

使用协议 mailto 和 GET 参数是正确的,但您还必须对字符串使用 urlencoded 版本:

<a href="mailto:[email protected]?subject=Website+Name&body=Link+to+website%2C+short+description">Send me an email</a>

Spaces become "+" or "%20". PHP provides function urlencode() for this, python 2.x urllib.urlencode() of the urllib module, Perl has uri_escape of the URI::Escape package ... and so on.

空格变为“+”或“%20”。PHP为此提供了函数urlencode(),urllib模块的python 2.x urllib.urlencode(),Perl有URI::Escape包的uri_escape……等等。

回答by JohnB

<a href="mailto:[email protected]?subject=Patrick's Website at patrickrules.com&body=<a href="http://www.patrickrules.com&quot; title="Link to Patrick's Official Website">It's Patrick's Official Website!</a>">Send to a friend

回答by ellisgeek

I think that you are going to need a simple form to allow people to enter there friends email address. php mail perhaps (just in case people don't have a email program).

我认为您将需要一个简单的表格来允许人们输入朋友的电子邮件地址。php mail 也许(以防万一人们没有电子邮件程序)。

回答by Ahmed Aman

<a href="mailto:[email protected]?subject=Feedback for 
webdevelopersnotes.com&body=Link to website, short description">Send to a friend</a>

回答by Brian S

Use <a href="mailto:..." />.

使用<a href="mailto:..." />.

Reference

参考