【问题标题】:send a html link in a email sent by php在 php 发送的电子邮件中发送 html 链接
【发布时间】:2013-04-05 05:04:58
【问题描述】:

我正在使用 html 表单 textarea 和 php 通过我的网站发送电子邮件

如何在邮件正文中添加链接。我确实喜欢这个

<a href="http://www.xxxxx.com/">Visit the site</a>

但我收到的是全文。我也试过了

<html>
  <head>
    <title>Test</title>
  </head>
  <body>
    <a href="http://www.xxxxx.com/">Visit the site</a>
  </body>
</html>

但我收到的是整个文本

【问题讨论】:

  • 让我们知道您正在编写什么代码来发送电子邮件
  • 发送电子邮件的代码在哪里??

标签: php html email


【解决方案1】:

确保正确添加标题

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

Example #4 Sending HTML email

【讨论】:

    【解决方案2】:

    您是否尝试在发送到邮件服务器的消息头中设置内容类型声明?

    内容类型:文本/html; charset=UTF-8

    【讨论】:

      【解决方案3】:

      将标题设置为text/html

      $headers = "MIME-Version: 1.0" . "\r\n";
      $headers .= "Content-type:text/html;charset=iso-8859-1";
      

      查看示例:PHP mail() function

      【讨论】:

        【解决方案4】:

        问题肯定出在你的标题中

        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
        

        使用这些标题,您的内容将被正确解释。

        看看here

        【讨论】:

          猜你喜欢
          • 2011-03-04
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-06-01
          相关资源
          最近更新 更多