Silverstripe:电子邮件功能问题

时间:2016-11-28 22:57:27

标签: php templates content-management-system html-email silverstripe

在提交查询/联系表单后,我尝试发送通知电子邮件(HTML)。电子邮件功能似乎存在问题。例如:

$email->send();

以下是我收到的电子邮件的屏幕截图。

Screenshot

到目前为止我学到了什么:

  • 电子邮件将作为"多部分"信息。它将一些文本作为纯文本发送,其中一些作为HTML发送。 (有关触发电子邮件功能的代码,请参见下文)
  • 我在电子邮件模板中设置了字符类型。
  • 我尝试将字符类型设置为控制器$email->addCustomHeader(...)
  • 中的电子邮件标题
  • 我尝试从标准的php mail()函数发送HTML电子邮件,HTML内容发送正常。电子邮件按预期工作。
  • 我联系了我的托管服务提供商并询问他们是否可以查看。他们说从他们的结果来看并不是问题。我倾向于相信它们,因为PHP mail()函数发送正常,但Silverstripe函数没有。
  • 我尝试了$email->sendPlain(),电子邮件以纯文本形式发送,但多部分消息没有问题。
  • 我尝试使用默认的Silverstripe电子邮件模板(GenericEmail.ss)发送电子邮件
  • 我正在使用Shea Dawson" Blocks"模块,从我创建的联系人块发送电子邮件。
  • 我使用SS 3.1.18进行其他网站构建,按预期发送电子邮件模板。我正在使用SS 3.4。

以下是我用来发送电子邮件的代码:

$email = new Email();
$email->setTo($to); 
$email->setFrom($data['Email']); 
$email->setSubject($subject);

// Send Email
$email->send();

以下是电子邮件的原始来源:

Return-Path: <REMOVED FOR PRIVACY>
Delivered-To: REMOVED FOR PRIVACY
Received: (qmail 17022 invoked by uid 399); 17 Nov 2016 01:10:11 -0000
Received: from unknown (HELO nix36.qnetau.com) (202.146.215.18)
  by REMOVED FOR PRIVACY with ESMTP; 17 Nov 2016 01:10:11 -0000
X-Originating-IP: 202.146.215.18
Received: by REMOVED FOR PRIVACY (Postfix, from userid 642)
    id 63D78B3A; Thu, 17 Nov 2016 01:10:11 +0000 (UTC)
To: REMOVED FOR PRIVACY
Subject: =?UTF-8?B??=
X-PHP-Originating-Script: 642:Mailer.php
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_NextPart_176699263819"
Content-Transfer-Encoding: 7bit
From: REMOVED FOR PRIVACY
X-Mailer: SilverStripe Mailer - version 2006.06.21 (Sent from "REMOVED FOR PRIVACY")
X-Priority: 3
X-SilverStripeSite: mysite
Message-Id: <20161117011011.63D78B3A@REMOVED FOR PRIVACY>
Date: Thu, 17 Nov 2016 01:10:11 +0000 (UTC)


This is a multi-part message in MIME format.

------=_NextPart_176699263819
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

TESTING BASE EMAIL TEMPLATE

------=_NextPart_176699263819
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org=
/TR/xhtml1/DTD/xhtml1-strict.dtd">=0A<html xmlns=3D"http://www.w3.org/1999/=
xhtml" xmlns=3D"http://www.w3.org/1999/xhtml">=0A    <head>=0A        <meta=
 http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8" />=0A  =
      <meta name=3D"viewport" content=3D"width=3Ddevice-width" />=0A    </h=
ead>=0A    <body style=3D"width: 100% !important; -webkit-text-size-adjust:=
 100%; -ms-text-size-adjust: 100%; color: #6c6e6d; font-family: 'Helvetica'=
, 'Arial', sans-serif; font-weight: normal; text-align: left; line-height: =
16px; font-size: 12px; background: #dbdbdb; margin: 0; padding: 0;" bgcolor=
=3D"#dbdbdb">=0A        <style type=3D"text/css">=0A            a:hover {=
=0A                color: #2795b6 !important;=0A            }=0A           =
 a:active {=0A                color: #2795b6 !important;=0A            }=0A=
            a:visited {=0A                color: #2ba6cb !important;=0A    =
        }=0A            h1 a:active {=0A                color: #2ba6cb !imp=
ortant;=0A            }=0A            h2 a:active {=0A                color=
: #2ba6cb !important;=0A            }=0A            h3 a:active {=0A       =
         color: #2ba6cb !important;=0A            }=0A            h4 a:acti=
ve {=0A                color: #2ba6cb !important;=0A            }=0A       =
     h5 a:active {=0A                color: #2ba6cb !important;=0A         =
   }=0A            h6 a:active {=0A                color: #2ba6cb !importan=
t;=0A            }=0A            h1 a:visited {=0A                color: #2=
ba6cb !important;=0A            }=0A            h2 a:visited {=0A          =
      color: #2ba6cb !important;=0A            }=0A            h3 a:visited=
 {=0A                color: #2ba6cb !important;=0A            }=0A         =
   h4 a:visited {=0A                color: #2ba6cb !important;=0A          =
  }=0A            h5 a:visited {=0A                color: #2ba6cb !importan=
t;=0A            }=0A            h6 a:visited {=0A                color: #2=
ba6cb !important;=0A            }=0A            table.button:hover td {=0A =
               background: #2795b6 !important;=0A            }=0A          =
  table.button:visited td {=0A                background: #2795b6 !importan=
t;=0A            }=0A            table.button:active td {=0A               =
 background: #2795b6 !important;=0A            }=0A            table.button=
:hover td a {=0A                color: #fff !important;=0A            }=0A =
           table.button:visited td a {=0A                color: #fff !impor=
tant;=0A            }=0A            table.button:active td a {=0A          =
      color: #fff !important;=0A            }=0A            table.button:ho=
ver td {=0A                background: #2795b6 !important;=0A            }=
=0A            table.tiny-button:hover td {=0A                background: #=
2795b6 !important;=0A            }=0A            table.small-button:hover t=
d {=0A                background: #2795b6 !important;=0A            }=0A   =
         table.medium-button:hover td {=0A                background: #2795=
b6 !important;=0A            }=0A            table.large-button:hover td {=
=0A                background: #2795b6 !important;=0A            }=0A      =
      table.button:hover td a {=0A                color: #ffffff !important=
;=0A            }=0A            table.button:active td a {=0A              =
  color: #ffffff !important;=0A            }=0A            table.button td =
a:visited {=0A                color: #ffffff !important;=0A            }=0A=
            table.tiny-button:hover td a {=0A                color: #ffffff=
 !important;=0A            }=0A            table.tiny-button:active td a {=
=0A                color: #ffffff !important;=0A            }=0A           =
 table.tiny-button td a:visited {=0A                color: #ffffff !importa=
nt;=0A            }=0A            table.small-button:hover td a {=0A       =
         color: #ffffff !important;=0A            }=0A            table.sma=
ll-button:active td a {=0A                color: #ffffff !important;=0A    =
        }=0A            table.small-button td a:visited {=0A               =
 color: #ffffff !important;=0A            }=0A            table.medium-butt=
on:hover td a {=0A                color: #ffffff !important;=0A            =
}=0A            table.medium-button:active td a {=0A                color: =
#ffffff !important;=0A            }=0A            table.medium-button td a:=
visited {=0A                color: #ffffff !important;=0A            }=0A  =
          table.large-button:hover td a {=0A                color: #ffffff =
!important;=0A            }=0A            table.large-button:active td a {=
=0A                color: #ffffff !important;=0A            }=0A           =
 table.large-button td a:visited {=0A                color: #ffffff !import=
ant;=0A            }=0A            table.secondary:hover td {=0A           =
     background: #d0d0d0 !important; color: #555;=0A            }=0A       =
     table.secondary:hover td a {=0A                color: #555 !important;=
=0A            }=0A            table.secondary td a:visited {=0A           =
     color: #555 !important;=0A            }=0A            table.secondary:=
active td a {=0A                color: #555 !important;=0A            }=0A =
           table.success:hover td {=0A                background: #457a1a !=
important;=0A            }=0A            table.alert:hover td {=0A         =
       background: #970b0e !important;=0A            }=0A            a:hove=
r {=0A                color: black !important;=0A            }=0A          =
  @media only screen and (max-width: 600px) {=0A                table[class=
=3D"body"] img {=0A                    width: auto !important; height: auto=
 !important;=0A                }=0A                table[class=3D"body"] ce=
nter {=0A                    min-width: 0 !important;=0A                }=
=0A                table[class=3D"body"] .container {=0A                   =
 width: 95% !important;=0A                }=0A                table[class=
=3D"body"] .row {=0A                    width: 100% !important; display: bl=
ock !important;=0A                }=0A                table[class=3D"body"]=
 .wrapper {=0A                    display: block !important; padding-right:=
 0 !important;=0A                }=0A                table[class=3D"body"] =
.columns {=0A                    table-layout: fixed !important;=0A        =
            float: none !important;=0A                    width: 100% !impo=
rtant;=0A                    padding-right: 0px !important;=0A             =
       padding-left: 0px !important;=0A                    display: block !=
important;=0A                }=0A                table[class=3D"body"] .col=
umn {=0A                    table-layout: fixed !important; float: none !im=
portant; width: 100% !important; padding-right: 0px !important; padding-lef=
t: 0px !important; display: block !important;=0A                }=0A       =
         table[class=3D"body"] .wrapper.first .columns {=0A                =
    display: table !important;=0A                }=0A                table[=
class=3D"body"] .wrapper.first .column {=0A                    display: tab=
le !important;=0A                }=0A                table[class=3D"body"] =
table.columns td {=0A                    width: 100% !important;=0A        =
        }=0A                table[class=3D"body"] table.column td {=0A     =
               width: 100% !important;=0A                }=0A              =
  table[class=3D"body"] td.offset-by-one {=0A                    padding-le=
ft: 0 !important;=0A                }=0A                table[class=3D"body=
"] td.offset-by-two {=0A                    padding-left: 0 !important;=0A =
               }=0A                table[class=3D"body"] td.offset-by-three=
 {=0A                    padding-left: 0 !important;=0A                }=0A=
                table[class=3D"body"] td.offset-by-four {=0A               =
     padding-left: 0 !important;=0A                }=0A                tabl=
e[class=3D"body"] td.offset-by-five {=0A                    padding-left: 0=
 !important;=0A                }=0A                table[class=3D"body"] td=
.offset-by-six {=0A                    padding-left: 0 !important;=0A      =
          }=0A                table[class=3D"body"] td.offset-by-seven {=0A=
                    padding-left: 0 !important;=0A                }=0A     =
           table[class=3D"body"] td.offset-by-eight {=0A                   =
 padding-left: 0 !important;=0A                }=0A                table[cl=
ass=3D"body"] td.offset-by-nine {=0A                    padding-left: 0 !im=
portant;=0A                }=0A                table[class=3D"body"] td.off=
set-by-ten {=0A                    padding-left: 0 !important;=0A          =
      }=0A                table[class=3D"body"] td.offset-by-eleven {=0A   =
                 padding-left: 0 !important;=0A                }=0A        =
        table[class=3D"body"] .expander {=0A                    width: 9999=
px !important;=0A                }=0A                table[class=3D"body"] =
.right-text-pad {=0A                    padding-left: 10px !important;=0A  =
              }=0A                table[class=3D"body"] .text-pad-right {=
=0A                    padding-left: 10px !important;=0A                }=
=0A                table[class=3D"body"] .left-text-pad {=0A               =
     padding-right: 10px !important;=0A                }=0A                =
table[class=3D"body"] .text-pad-left {=0A                    padding-right:=
 10px !important;=0A                }=0A                table[class=3D"body=
"] .hide-for-small {=0A                    display: none !important;=0A    =
            }=0A                table[class=3D"body"] .show-for-desktop {=
=0A                    display: none !important;=0A                }=0A    =
            table[class=3D"body"] .show-for-small {=0A                    d=
isplay: inherit !important;=0A                }=0A                table[cla=
ss=3D"body"] .hide-for-desktop {=0A                    display: inherit !im=
portant;=0A                }=0A                table[class=3D"body"] .right=
-text-pad {=0A                    padding-left: 10px !important;=0A        =
        }=0A                table[class=3D"body"] .left-text-pad {=0A      =
              padding-right: 10px !important;=0A                }=0A       =
     }=0A        </style>=0A        =0A        <table class=3D"container" s=
tyle=3D"border-spacing: 0; border-collapse: collapse; vertical-align: top; =
text-align: inherit; width: 580px; background: white; margin: 0 auto; paddi=
ng: 0;" bgcolor=3D"white">=0A            <tr style=3D"vertical-align: top; =
text-align: left; padding: 0;" align=3D"left">=0A                <td style=
=3D"word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyph=
ens: auto; border-collapse: collapse !important; vertical-align: top; text-=
align: left; padding: 0;" align=3D"left" valign=3D"top">=0A=0A             =
       <table class=3D"row" style=3D"border-spacing: 0; border-collapse: co=
llapse; vertical-align: top; text-align: left; width: 100%; position: relat=
ive; display: block; padding: 0px;">=0A                        <tr style=3D=
"vertical-align: top; text-align: left; padding: 0;" align=3D"left">=0A=0A =
                           <td class=3D"wrapper" style=3D"word-break: break=
-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-col=
lapse: collapse !important; vertical-align: top; text-align: left; position=
: relative; padding: 10px;" align=3D"left" valign=3D"top">=0A=0A           =
                     <table class=3D"twelve columns" style=3D"border-spacin=
g: 0; border-collapse: collapse; vertical-align: top; text-align: left; wid=
th: 580px; margin: 0 auto; padding: 0;">=0A                                =
    <tr style=3D"vertical-align: top; text-align: left; padding: 0;" align=
=3D"left">=0A                                        <td class=3D"twelve su=
b-columns" align=3D"center" style=3D"word-break: break-word; -webkit-hyphen=
s: auto; -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !impo=
rtant; vertical-align: top; text-align: left; min-width: 0px; width: 100% !=
important; padding: 0px 10px 10px 0px;" valign=3D"top">=0A                 =
                           <div style=3D"text-align: center;" align=3D"cent=
er">=0A                                                <img src=3D"http://=
REMOVED FOR PRIVACY/mysite/images/email/logo.png" style=3D"float: none=
; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; wi=
dth: auto; max-width: 100%; clear: both; display: block; margin: 0 auto;" a=
lign=3D"none" />=0A                                            </div>=0A   =
                                     </td>=0A                              =
      </tr>=0A                                </table>=0A=0A               =
                 <hr style=3D"color: #d9d9d9; height: 1px; background: #d9d=
9d9; border: none;" />=0A=0A                                <table class=3D=
"twelve columns" style=3D"border-spacing: 0; border-collapse: collapse; ver=
tical-align: top; text-align: left; width: 580px; margin: 0 auto; padding: =
0;">=0A                                    <tr style=3D"vertical-align: top=
; text-align: left; padding: 0;" align=3D"left">=0A                        =
                <td style=3D"word-break: break-word; -webkit-hyphens: auto;=
 -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; v=
ertical-align: top; text-align: left; padding: 0px 0px 10px;" align=3D"left=
" valign=3D"top">=0A                                            <!-- EMAIL =
CONTENT HERE -->=0A                                        </td>=0A        =
                                <td class=3D"expander" style=3D"word-break:=
 break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; bord=
er-collapse: collapse !important; vertical-align: top; text-align: left; vi=
sibility: hidden; width: 0px; padding: 0;" align=3D"left" valign=3D"top">=
=0A                                            =0A                         =
               </td>=0A                                    </tr>=0A        =
                        </table>=0A                            </td>=0A=0A =
                       </tr>=0A                    </table>=0A=0A          =
          <table class=3D"row" style=3D"border-spacing: 0; border-collapse:=
 collapse; vertical-align: top; text-align: left; width: 100%; position: re=
lative; display: block; padding: 0px;">=0A                        <tr style=
=3D"vertical-align: top; text-align: left; padding: 0;" align=3D"left">=0A =
                           <td class=3D"wrapper last" style=3D"word-break: =
break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; borde=
r-collapse: collapse !important; vertical-align: top; text-align: left; pos=
ition: relative; padding: 10px 0px 10px 10px;" align=3D"left" valign=3D"top=
">=0A=0A                                <table class=3D"twelve columns" sty=
le=3D"border-spacing: 0; border-collapse: collapse; vertical-align: top; te=
xt-align: left; width: 580px; margin: 0 auto; padding: 0;">=0A             =
                       <tr style=3D"vertical-align: top; text-align: left; =
padding: 0;" align=3D"left">=0A                                        <td =
align=3D"center" style=3D"word-break: break-word; -webkit-hyphens: auto; -m=
oz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; vert=
ical-align: top; text-align: left; padding: 0px 0px 10px;" valign=3D"top">=
=0A                                            <center style=3D"width: 100%=
; min-width: 580px;">=0A                                                <p>=
TESTING BASE EMAIL TEMPLATE</p>=0A                                         =
   </center>=0A                                        </td>=0A            =
                            <td class=3D"expander" style=3D"word-break: bre=
ak-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-c=
ollapse: collapse !important; vertical-align: top; text-align: left; visibi=
lity: hidden; width: 0px; padding: 0;" align=3D"left" valign=3D"top">=0A   =
                                         =0A                               =
         </td>=0A                                    </tr>=0A              =
                  </table>=0A                            </td>=0A          =
              </tr>=0A                    </table>=0A                    <!=
-- container end below -->=0A                </td>=0A            </tr>=0A  =
      </table>=0A    </body>=0A</html>=0A
------=_NextPart_176699263819--

任何人都可以帮我调试这个问题吗?如果您需要其他任何信息,请与我们联系。感谢您的帮助...

0 个答案:

没有答案