簡體   English   中英

php imap_mail不提供電子郵件

[英]php imap_mail do not develiver email

嗨,我正在嘗試通過imap_mail函數發送電子郵件

http://php.net/manual/zh/function.imap-mail.php

$to = implode(", ", $sentTo);
$subject = $email_info['subject'];
$body = wordwrap($email_info['body']);
$headers = "MIME-Version: 1.0;\r\nContent-type: text/html; charset=iso-8859-1;\r\nContent-Transfer-Encoding: 8bit;\r\n"
                        . "From: " . $account_doc->email . "\r\n" . "Reply-To: " . $account_doc->email . "\r\n";
$return_path = $account_doc->email;
$cc = implode(", ", $sentCC);
$bcc = implode(", ", $sentBCC);

if ( strlen($cc) === 0 ) $cc = NULL;
if ( strlen($bcc) === 0 ) $bcc = NULL;
if ( strlen($subject) === 0 ) $subject = "-";

$is_sent = imap_mail($to, $subject, $body, $headers, $cc, $bcc, $return_path);

if ($is_sent) {
    imap_append( $connection , $account_doc->activeFolders->SENT
                    , "MIME-Version: 1.0;\r\nContent-type: text/html; charset=iso-8859-1;\r\nContent-Transfer-Encoding: 8bit;\r\n"
                            . "From: {$this->userDoc->name}\r\nTo: {$to}\r\nSubject: {$subject}\r\nDate: " . date("r", strtotime("now")) . "\r\n\r\n{$body}\r\n"
                    );

imap_close($connection);

$this->json_response("Email is sent");

imap_mail函數返回true,並附加了電子郵件,我可以在郵箱中看到它。 但是,當我檢查發送電子郵件的電子郵件時,這些電子郵件未送達。

有誰知道是什么原因造成了這個問題。

通常, IMAP不發送電子郵件。 APPEND所做的只是向郵件文件夾中添加一條消息,它不會導致傳遞。 通常,您需要為此使用SMTP 典型的電子郵件客戶端將通過SMTP發送,然后將相同的郵件附加到SENT文件夾。

某些服務器(例如Courier )具有可選的擴展名,可以通過特殊的發件箱文件夾發送電子郵件,但是這種擴展名並未得到廣泛部署或支持。

暫無
暫無

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

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