【问题标题】:HTML: "send to a friend" linkHTML:“发送给朋友”链接
【发布时间】:2013-11-26 21:51:31
【问题描述】:

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

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

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

这可能吗? 谢谢

【问题讨论】:

标签: html email mailto


【解决方案1】:
<a href="mailto:enteryour@addresshere.com?subject=Website Name&body=Link to website, short description">Send me an email</a>

是一种方式。

【讨论】:

  • 呃,为什么我的 Safari 访问的是新页面而不是发送电子邮件?而 Firefox 只是什么都不做?我刚刚复制粘贴了你的代码。谢谢
  • 这实际上/仍然是个问题吗?
  • 据我所知,mailto 在这些浏览器中应该不会造成问题。也许某些插件/加载项导致了问题?您可以尝试 Luc 的评论(或发送不带空格的内容)。
【解决方案2】:

使用协议 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 ...等等。

【讨论】:

    【解决方案3】:

    &lt;a href="mailto:myfriend@gmail.com?subject=Patrick's Website at patrickrules.com&amp;body=&lt;a href="@987654321@; title="Link to Patrick's Official Website"&gt;It's Patrick's Official Website!&lt;/a&gt;"&gt;Send to a friend

    【讨论】:

      【解决方案4】:
      <a href="mailto:s123@example.com?subject=Feedback for 
      webdevelopersnotes.com&body=Link to website, short description">Send to a friend</a>
      

      【讨论】:

      • 您的 Google-Fu 和我的一样强大。 :)
      【解决方案5】:

      使用&lt;a href="mailto:..." /&gt;

      Reference

      【讨论】:

        【解决方案6】:

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

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2011-02-04
          • 1970-01-01
          • 1970-01-01
          • 2014-08-14
          • 1970-01-01
          • 1970-01-01
          • 2011-11-04
          相关资源
          最近更新 更多