簡體   English   中英

PHP 郵件 function 失敗,並顯示“消息的行太長,無法傳輸”

[英]PHP mail function fails with "message has lines too long for transport"

我正在使用 PHP 7.4.30,我對 PHP 完全陌生。

$subject ="My subject";

$message = '<html><body>';
$message .= '<div style="text-align: center; width: 100%; background-color: #fff;">';
$message .= '<div class="info">&nbsp;</div>';
$message .= '<table style="text-align: justify; margin: auto; background-color: #ebebeb; border: 1px solid #e7e7e7; width: 600px;" cellspacing="0" cellpadding="0" bgcolor="#ebebeb" align="center">';
$message .= '<tbody>';
$message .= '<tr style="line-height: 0px;">';
$message .= '<td style="line-height: 0';


$from = "My website<robot@website.com>";
$replyto = "website@website.com"; 

$headers = 'Content-Type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$headers .= 'Reply-To: '. $replyto . "\r\n";
$headers .= 'Bcc: xxx@xxx.com'; 

$message = str_replace("\n.", "\n..", $message);
mail($to, $subject, $message, $headers);

查看來自服務器的交付跟蹤,我看到錯誤消息:

"message has lines too long for transport"

任何人都可以幫忙嗎?

我最近遇到了這個問題。 解決此問題的一個簡單方法是替換此行

$message = str_replace("\n.", "\n..", $message);

$message = wordwrap($message, 70,"\r\n");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM