【问题标题】:PHP is Only Sending Part of the Email [duplicate]PHP仅发送部分电子邮件[重复]
【发布时间】:2017-07-26 15:48:38
【问题描述】:

所以,我有一个 PHP script,它基本上会在您退订时发送一封电子邮件。代码很好,所以我将它输入到我的 PHP 中,但它只发送了一部分。 Here 是应有的 JSFiddle。这不是很干净,因为这是电子邮件的 HTML,但这不是重点。所以我有我的电子邮件代码,我可以运行它并查看它是否完美运行,并按照我想要的方式运行电子邮件。我也测试了我的 PHP。它向我发送了一封电子邮件,并且我之前已经对其进行了测试,这让我知道它确实发送了所请求的内容。这是我的 PHP 代码:

<?php
  $to = 'example@example.com';

  $subject = 'Sorry To See You Go!';

  $headers = "From: example@example.com" . strip_tags($_POST['req-email']) . "\r\n";
  $headers .= "Reply-To: example@example.com". strip_tags($_POST['req-email']) . "\r\n";
  $headers .= "CC: example@example.com\r\n";
  $headers .= "MIME-Version: 1.0\r\n";
  $headers .= "Content-Type: text/html; charset=UTF-8\r\n";

  $message .= '<table align="center" border="0" cellpadding="0" cellspacing="0" class="main-width" width="630" style="border-collapse: collapse; table-layout: fixed; font-family: &quot;Times New Roman&quot;; font-size: medium; width: 630px;"><tbody><tr><td align="center" class="layout" valign="top" style="padding: 15px 5px;"><table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed;"><tbody><tr><td align="center" bgcolor="#4C4C4C" class="layout-container-border" valign="top" style="background: rgb(76, 76, 76); padding: 10px;"><table align="center" bgcolor="#4C4C4C" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><tbody><tr><td align="center" bgcolor="#FFFFFF" class="layout-container" valign="top" style="background: rgb(255, 255, 255); padding: 0px;"><div class=""><table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="left" class="logo OneColumnMobile column" valign="top" width="100%"><div class="gl-contains-image"><table border="0" cellpadding="0" cellspacing="0" class="editor-image logo-container editor-image-vspace-on" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="center" valign="top" style="padding-bottom: 10px; padding-top: 10px;"><div class="publish-container"><a href="http://html-hub.net16.net/" target="_blank" style="text-decoration-line: underline;"><img alt="" border="0" class="" hspace="0" src="http://files.constantcontact.com/69a6c42a601/8b94df2c-ed2c-40ea-ad5d-12bd5a1f8eab.png" vspace="0" width="197" style="display: block;"></a></div></td></tr></tbody></table></div></td></tr></tbody></table><table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="" class="OneColumnMobile column" valign="top" width="100%"><div class="gl-contains-text"><table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="left" class="editor-text editor-text " valign="top" style="-webkit-font-smoothing: antialiased; color: rgb(64, 63, 66); display: block; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; padding: 10px 20px; word-wrap: break-word;"><div></div><div><div align="center" style="text-align: center;">&nbsp;&nbsp;<span style="color: rgb(71, 155, 70); font-size: 24px; font-weight: bold;">Sorry To See You Go!</span></div></div></td></tr></tbody></table></div></td></tr></tbody></table><table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="" class="OneColumnMobile column" valign="top" width="100%"><div class="gl-contains-divider"><table border="0" cellpadding="0" cellspacing="0" class="editor-divider" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="center" class="" valign="top"><table class="galileo-ap-content-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; cursor: default; min-width: 100%;"><tbody><tr><td align="center" class="divider-base divider-solid" valign="top" width="100%" style="padding: 9px 0px 10px;"><table align="center" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; table-layout: fixed; height: 1px; min-width: 95%; width: 570.4px;"><tbody><tr><td align="center" bgcolor="rgb(69, 179, 202)" height="1" style="background: rgb(69, 179, 202); border-bottom-style: none; height: 1px; line-height: 1px; padding-bottom: 4px;"><img alt="" border="0" height="1" hspace="0" src="https://imgssl.constantcontact.com/letters/images/1101116784221/S.gif" vspace="0" width="5" style="display: block; height: 1px; width: 5px;"></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></div></td></tr></tbody></table><table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="" class="OneColumnMobile column" valign="top" width="100%"><div class="gl-contains-text"><table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="left" class="editor-text editor-text " valign="top" style="-webkit-font-smoothing: antialiased; color: rgb(64, 63, 66); display: block; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; padding: 10px 20px; word-wrap: break-word;"><div></div><div><div align="center" style="text-align: center;"><div>&nbsp;<span style="font-size: 18px;">At CyanCoding, we try out best to present our users with easy accessibility, fun programs, and a quality website. We think you made a mistake by unsubscribing, but you are the boss! You will no longer receive emails stating new programs, updates, or other news.</span><br></div><br></div></div></td></tr></tbody></table></div></td></tr></tbody></table><table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="" class="OneColumnMobile column" valign="top" width="100%"><div class="gl-contains-divider"><table border="0" cellpadding="0" cellspacing="0" class="editor-divider" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="center" class="" valign="top"><table class="galileo-ap-content-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; cursor: default; min-width: 100%;"><tbody><tr><td align="center" class="divider-base divider-solid" valign="top" width="100%" style="padding: 9px 0px 10px;"><table align="center" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; table-layout: fixed; height: 1px; min-width: 95%; width: 570.4px;"><tbody><tr><td align="center" bgcolor="rgb(69, 179, 202)" height="1" style="background: rgb(69, 179, 202); border-bottom-style: none; height: 1px; line-height: 1px; padding-bottom: 4px;"><img alt="" border="0" height="1" hspace="0" src="https://imgssl.constantcontact.com/letters/images/1101116784221/S.gif" vspace="0" width="5" style="display: block; height: 1px; width: 5px;"></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></div></td></tr></tbody></table><table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="" class="OneColumnMobile column" valign="top" width="100%"><div class="gl-contains-text"><table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="left" class="editor-text editor-text " valign="top" style="-webkit-font-smoothing: antialiased; color: rgb(64, 63, 66); display: block; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; padding: 10px 20px; word-wrap: break-word;"><div></div><div><div align="center" style="text-align: center;"><span style="font-size: 14px;">If you believe this to be a mistake, please click the button below.</span></div></div></td></tr></tbody></table></div></td></tr></tbody></table><table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="" class="OneColumnMobile column" valign="top" width="100%"><div class="gl-contains-button"><table border="0" cellpadding="0" cellspacing="0" class="editor-button" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%; width: 600.8px;"><tbody><tr><td class="editor-button-container editor-button-container " style="color: rgb(255, 255, 255); font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 14px; padding: 10px 20px;"><table class="galileo-ap-content-editor" style="border-collapse: collapse; table-layout: fixed; min-width: 100%; width: 560.8px;"><tbody><tr><td align="center" class="MainTextFullWidthTD" valign="top" style="font-family: Arial, Verdana, Helvetica, sans-serif; padding: 0px;"><table bgcolor="#4C4C4C" border="0" cellpadding="0" cellspacing="0" class="" style="border-collapse: collapse; table-layout: fixed; background: rgb(76, 76, 76); border-spacing: 0px; border: none; min-width: initial; padding: 0px; width: initial;"><tbody><tr><td align="center" class="MainTextFullWidthTD" valign="top" style="font-family: Arial, Verdana, Helvetica, sans-serif; padding: 9px 15px 10px;"><div class="MainTextFullWidth" style="-webkit-font-smoothing: antialiased;"><a href="http://cyancoding.net16.net/subscribe.html" target="_blank" style="color: rgb(255, 255, 255);">Subscribe</a></div></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></div></td></tr></tbody></table><table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="left" bgcolor="#4C4C4C" class="about OneColumnMobile column" valign="top" width="100%" style="background: rgb(76, 76, 76);"><div class="gl-contains-text"><table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"><tbody><tr><td align="left" class="editor-text about-text" valign="top" style="-webkit-font-smoothing: antialiased; color: rgb(255, 255, 255); display: block; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; padding: 10px 20px; text-align: center; word-wrap: break-word;"><div></div><div><a href="mailto:skyecam21@gmail.com" target="_blank" style="text-decoration-line: underline; color: rgb(106, 194, 213);">Email</a>&nbsp;|&nbsp;<a href="http://cyancoding.net16.net/" target="_blank" style="text-decoration-line: underline; color: rgb(106, 194, 213);">Website</a>&nbsp;|&nbsp;<a href="http://cyancoding.net16.net/subscribe.html" target="_blank" style="text-decoration-line: underline; color: rgb(106, 194, 213);">Subscribe</a></div></td></tr></tbody></table></div></td></tr></tbody></table></div></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><span></span>';


  mail($to, $subject, $message, $headers);
?>

P.S 我会在上面填写 example@example.com 的电子邮件地址

所以,如果你运行这个,结果邮件如下:

这根本不对!如我们所见,这与我们之前看到的JSFiddle 相差甚远。

我希望 PHP 像 HTML 一样发送电子邮件。如果有帮助,这里是 sn-p 中的电子邮件代码:

&lt;table align="center" border="0" cellpadding="0" cellspacing="0" class="main-width" width="630" style="border-collapse: collapse; table-layout: fixed; font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; width: 630px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" class="layout" valign="top" style="padding: 15px 5px;"&gt;&lt;table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" bgcolor="#4C4C4C" class="layout-container-border" valign="top" style="background: rgb(76, 76, 76); padding: 10px;"&gt;&lt;table align="center" bgcolor="#4C4C4C" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" bgcolor="#FFFFFF" class="layout-container" valign="top" style="background: rgb(255, 255, 255); padding: 0px;"&gt;&lt;div class=""&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="left" class="logo OneColumnMobile column" valign="top" width="100%"&gt;&lt;div class="gl-contains-image"&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="editor-image logo-container editor-image-vspace-on" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" valign="top" style="padding-bottom: 10px; padding-top: 10px;"&gt;&lt;div class="publish-container"&gt;&lt;a href="http://html-hub.net16.net/" target="_blank" style="text-decoration-line: underline;"&gt;&lt;img alt="" border="0" class="" hspace="0" src="http://files.constantcontact.com/69a6c42a601/8b94df2c-ed2c-40ea-ad5d-12bd5a1f8eab.png" vspace="0" width="197" style="display: block;"&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="" class="OneColumnMobile column" valign="top" width="100%"&gt;&lt;div class="gl-contains-text"&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="left" class="editor-text editor-text " valign="top" style="-webkit-font-smoothing: antialiased; color: rgb(64, 63, 66); display: block; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; padding: 10px 20px; word-wrap: break-word;"&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;div align="center" style="text-align: center;"&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(71, 155, 70); font-size: 24px; font-weight: bold;"&gt;Sorry To See You Go!&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="" class="OneColumnMobile column" valign="top" width="100%"&gt;&lt;div class="gl-contains-divider"&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="editor-divider" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" class="" valign="top"&gt;&lt;table class="galileo-ap-content-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; cursor: default; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" class="divider-base divider-solid" valign="top" width="100%" style="padding: 9px 0px 10px;"&gt;&lt;table align="center" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; table-layout: fixed; height: 1px; min-width: 95%; width: 570.4px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" bgcolor="rgb(69, 179, 202)" height="1" style="background: rgb(69, 179, 202); border-bottom-style: none; height: 1px; line-height: 1px; padding-bottom: 4px;"&gt;&lt;img alt="" border="0" height="1" hspace="0" src="https://imgssl.constantcontact.com/letters/images/1101116784221/S.gif" vspace="0" width="5" style="display: block; height: 1px; width: 5px;"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="" class="OneColumnMobile column" valign="top" width="100%"&gt;&lt;div class="gl-contains-text"&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="left" class="editor-text editor-text " valign="top" style="-webkit-font-smoothing: antialiased; color: rgb(64, 63, 66); display: block; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; padding: 10px 20px; word-wrap: break-word;"&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;div align="center" style="text-align: center;"&gt;&lt;div&gt;&amp;nbsp;&lt;span style="font-size: 18px;"&gt;At CyanCoding, we try out best to present our users with easy accessibility, fun programs, and a quality website. We think you made a mistake by unsubscribing, but you are the boss! You will no longer receive emails stating new programs, updates, or other news.&lt;/span&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="" class="OneColumnMobile column" valign="top" width="100%"&gt;&lt;div class="gl-contains-divider"&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="editor-divider" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" class="" valign="top"&gt;&lt;table class="galileo-ap-content-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; cursor: default; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" class="divider-base divider-solid" valign="top" width="100%" style="padding: 9px 0px 10px;"&gt;&lt;table align="center" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; table-layout: fixed; height: 1px; min-width: 95%; width: 570.4px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" bgcolor="rgb(69, 179, 202)" height="1" style="background: rgb(69, 179, 202); border-bottom-style: none; height: 1px; line-height: 1px; padding-bottom: 4px;"&gt;&lt;img alt="" border="0" height="1" hspace="0" src="https://imgssl.constantcontact.com/letters/images/1101116784221/S.gif" vspace="0" width="5" style="display: block; height: 1px; width: 5px;"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="" class="OneColumnMobile column" valign="top" width="100%"&gt;&lt;div class="gl-contains-text"&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="left" class="editor-text editor-text " valign="top" style="-webkit-font-smoothing: antialiased; color: rgb(64, 63, 66); display: block; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; padding: 10px 20px; word-wrap: break-word;"&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;div align="center" style="text-align: center;"&gt;&lt;span style="font-size: 14px;"&gt;If you believe this to be a mistake, please click the button below.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="" class="OneColumnMobile column" valign="top" width="100%"&gt;&lt;div class="gl-contains-button"&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="editor-button" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%; width: 600.8px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="editor-button-container editor-button-container " style="color: rgb(255, 255, 255); font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 14px; padding: 10px 20px;"&gt;&lt;table class="galileo-ap-content-editor" style="border-collapse: collapse; table-layout: fixed; min-width: 100%; width: 560.8px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" class="MainTextFullWidthTD" valign="top" style="font-family: Arial, Verdana, Helvetica, sans-serif; padding: 0px;"&gt;&lt;table bgcolor="#4C4C4C" border="0" cellpadding="0" cellspacing="0" class="" style="border-collapse: collapse; table-layout: fixed; background: rgb(76, 76, 76); border-spacing: 0px; border: none; min-width: initial; padding: 0px; width: initial;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" class="MainTextFullWidthTD" valign="top" style="font-family: Arial, Verdana, Helvetica, sans-serif; padding: 9px 15px 10px;"&gt;&lt;div class="MainTextFullWidth" style="-webkit-font-smoothing: antialiased;"&gt;&lt;a href="http://cyancoding.net16.net/subscribe.html" target="_blank" style="color: rgb(255, 255, 255);"&gt;Subscribe&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="galileo-ap-layout-editor" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="left" bgcolor="#4C4C4C" class="about OneColumnMobile column" valign="top" width="100%" style="background: rgb(76, 76, 76);"&gt;&lt;div class="gl-contains-text"&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; table-layout: fixed; min-width: 100%;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="left" class="editor-text about-text" valign="top" style="-webkit-font-smoothing: antialiased; color: rgb(255, 255, 255); display: block; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; padding: 10px 20px; text-align: center; word-wrap: break-word;"&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="mailto:skyecam21@gmail.com" target="_blank" style="text-decoration-line: underline; color: rgb(106, 194, 213);"&gt;Email&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href="http://cyancoding.net16.net/" target="_blank" style="text-decoration-line: underline; color: rgb(106, 194, 213);"&gt;Website&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href="http://cyancoding.net16.net/subscribe.html" target="_blank" style="text-decoration-line: underline; color: rgb(106, 194, 213);"&gt;Subscribe&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span&gt;&lt;/span&gt;

编辑:这不起作用的原因是我的邮件服务器没有执行部分代码。不过我确实解决了这个问题。

【问题讨论】:

  • 首先删除$message .= 中的点,因为在此之前我没有看到任何其他声明。
  • 渲染方式取决于使用的电子邮件客户端。您通过什么方式接收它(例如 Gmail、Outlook)?
  • 我还要说 - 添加一个 Content-Length 标头。
  • 您要在此处附加的另一个$message $message .= 在哪里
  • 我还想说摆脱“我们认为您犯了错误”,除非您希望您的客户完全确定他们做了正确的事情。

标签: php html email


【解决方案1】:

正如弗雷德所说,删除$message .= 点,我问

您在此处附加的另一个 $message $message .= 是什么意思:

注意:未定义的变量:第 12 行的消息

因此更改$message .= "...";

$message = "..."

然后你就会得到结果

【讨论】:

    【解决方案2】:

    尝试添加 "Content-Transfer-Encoding: base64\r\n" 参数以删除字符限制

    mail($to, $subject, chunk_split(base64_encode($message), "Content-Transfer-Encoding: base64\r\n");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-08
      • 1970-01-01
      • 1970-01-01
      • 2015-12-10
      • 1970-01-01
      相关资源
      最近更新 更多