PEAR Mail SMTP/ MIME 和 HTML 格式

发布于 2025-01-07 15:39:57 字数 172 浏览 1 评论 0原文

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

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

我可以看到 PEAR 执行 MIME 和 SMTP,但我不知道是否可以将两者链接在一起?

谢谢。

H.

I am trying to setup PEAR to send SMTP emails, which has worked correctly.

However, I need to send the messages via SMTP but I need the emails to be sent in HTML format - is this possible.

I can see that PEAR does MIME and SMTP but I've no idea if it is possible to link the two together?

Thanks.

H.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

老街孤人 2025-01-14 15:39:57

这是可能的..

这是使用它的代码..

    $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:'sans-serif', 'HelveticaNeue Condensed', 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:'sans-serif', 'HelveticaNeue LightCond', 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:'sans-serif', 'HelveticaNeue Condensed', 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
                        );

its possible..

here is the code to work with it..

    $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:'sans-serif', 'HelveticaNeue Condensed', 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:'sans-serif', 'HelveticaNeue LightCond', 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:'sans-serif', 'HelveticaNeue Condensed', 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
                        );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文