我需要在我的网站上添加一个“发送给朋友”链接。
当用户点击它时,他们的电子邮件软件应该会打开并且电子邮件应该已经填满。
主题:网站名称正文:网站链接,简短说明
那可能吗 ?谢谢
<a href="mailto:enteryour@addresshere.com?subject=Website Name&body=Link to website, short description">Send me an email</a>
是一种方式。
使用协议 mailto 和 GET 参数是正确的,但您还必须对字符串使用 urlencoded 版本:
<a href="mailto:enteryour@addresshere.com?subject=Website+Name&body=Link+to+website%2C+short+description">Send me an email</a>
空格变为“+”或“%20”。PHP为此提供函数urlencode(),python 2.x urllib模块的urllib.urlencode(),Perl有URI::Escape包的uri_escape ...等等。
<a href="mailto:myfriend@gmail.com?subject=Patrick's Website at patrickrules.com&body=<a href="http://www.patrickrules.com" title="Link to Patrick's Official Website">It's Patrick's Official Website!</a>">Send to a friend
<a href="mailto:s123@example.com?subject=Feedback for
webdevelopersnotes.com&body=Link to website, short description">Send to a friend</a>
使用<a href="mailto:..." />
.
我认为您将需要一个简单的表格来允许人们在那里输入朋友的电子邮件地址。也许是 php 邮件(以防万一人们没有电子邮件程序)。