html - PEAR Mail SMTP/MIME 和 HTML 格式

标签 html email smtp pear mime

我正在尝试设置 PEAR 以发送 SMTP 电子邮件,它工作正常。

但是,我需要通过 SMTP 发送消息,但我需要以 HTML 格式发送电子邮件 - 这可能吗。

我可以看到 PEAR 支持 MIME 和 SMTP,但我不知道是否可以将两者联系起来?

谢谢。

H.

最佳答案

有可能..

这是使用它的代码..

    $to =  $customer_email;//user mail id
                        $subject = "some subject";

                        $htmlBody="<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">

<style type=\"text/css\">

SPAN {
 font-style:normal;
 font-weight:normal
}

H4 {
 text-align:left;
 margin-bottom:0px;
 margin-top:0px;
 margin-right:0px;
 direction:ltr
}
P {
 text-align:left;
 margin-bottom:12px;
 margin-top:0px;
 margin-right:11px;
 direction:ltr;
 line-height:15px
}


</style>

</head>
<body style=\"background-repeat: no-repeat\";>


<table width=\"600\" height=\"80%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">

  <tr bgcolor=\"#e3f3fd\">
  <td height=\"30%\">
  <img src=\"$logo\" alt=\"Royal Caribbean\" width=\"70px\" height=\"60px\" style=\"margin-left:50px;text-align:center;vertical-align:top;margin-bottom:14px;margin-top:25px;margin-right:0px;direction:ltr\">
  </td></tr>
  <tr ><td bgcolor=\"#e3f3fd\" width=\"600\" valign=\"top\" ><div style=\"text-align:left;margin-bottom:0px;margin-left:45px;margin-top:-20px;margin-right:0px;text-indent:0px;\">
      <h4 style=\"text-indent:0px;\"> <span style=\"font-family:&#39;sans-serif&#39;, &#39;HelveticaNeue Condensed&#39;, sans-serif; font-size:10pt; font-weight:bold; font-stretch:condensed; color:#265EAC\">Dear $customer,</span></h4>
      <p style=\"text-indent:0px;\"> <span style=\"font-family:&#39;sans-serif&#39;, &#39;HelveticaNeue LightCond&#39;, sans-serif; font-size:10pt; font-weight:normal; font-stretch:condensed; color:#265EAC\">Thanks for your blah blah blah blah blah <br/>blah blah blah blah<a href=\"$link\">clicking here</a></span></p>

      WE LOOK FORWARD TO SEE AGAIN WITH our branch </span></h4>
      <h4 style=\"text-indent:0px;\"> <span style=\"font-family:&#39;sans-serif&#39;, &#39;HelveticaNeue Condensed&#39;, sans-serif; font-size:10pt; font-weight:bold; font-stretch:condensed; color:#265EAC\">
    </div>
    </td></tr>

     <tr>
    <td><img src=\"$imagefooter\" style=\"margin-top: -30px;text-align:center;vertical-align:top;margin-bottom:14px;margin-right:0px;margin-left:0px;direction:ltr\"></td>
    </tr>
</table>


</body></html>";




                        Yii::app()->mailEx->pear(
                            $customer, // Recipient name
                            $to,
                            $subject,
                            $htmlBody
                        );

关于html - PEAR Mail SMTP/MIME 和 HTML 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9378566/

相关文章:

html - 电子邮件 HTML 签名在 Web 客户端上添加空白 HTML 元素,导致布局中断

javascript - 为什么我无法在 Google Chrome 中返回 cookie?

objective-c - UIActivityViewController 关闭 MailViewController

HTML电子邮件签名文件在回复中有黑边

c# - 通过 SMTP 发送电子邮件失败 : MailBox name not allowed

java - 为什么此 java 邮件以纯文本而不是 html 形式到达收件人?

c# - 如何发送带有 SSL 证书的电子邮件?

html - getUserMedia API 不适用于 React 中的 iOS Safari

javascript - jQuery 使用自定义顺序对 HTML 表格进行排序

python - 如何将 smtp 调试信息记录到文件中?