2017-05-28 54 views
2

之後沒有運行任何代碼我已經設置了一個php程序,其中包含一個phpmailer發送,它在我的本地機器上工作得很好,但它不會在send()命令後運行任何代碼。phpmailer發送郵件後從服務器斷開連接;在

這裏是本地工作很好,幾乎是相同的,我的聯繫頁面上正常工作現場代碼代碼:

$subject = ""; 
$subject .= "Welcome to Your Strength Coach!"; 

$body = ""; 
$body .= " 
Hi " . $nameFirst . ", 
<br><br> 
Welcome to <a href=\"https://www.yourstrengthcoach.com/\">Your Strength Coach</a>! 
<br><br> 
Thank you for signing up. We look forward to being a part of your health and fitness journey. 
<br><br> 
Be sure to check out the Getting Started section on the Your Account page to get answers to the most common questions we receive. If you have any that aren't answered there, please feel free to email us at anytime. You can reach us at [email protected] 
<br><br> 
Thanks again,<br> 
Brian Gwaltney, Creator 
<br><br> 
Be sure to check us out on <a href=\"https://www.facebook.com/YourStrengthCoach1/\">Facebook</a>, <a href=\"https://www.instagram.com/yourstrengthcoach/\">Instagram</a>, and <a href=\"https://www.pinterest.com/yourstrengthcoach/\">Pinterest</a>!"; 
$mail = new PHPMailer; 
    $mail->IsSMTP(); // Use SMTP 
    $mail->Host = "smtp.servergrove.com"; // Sets SMTP server 
    $mail->SMTPDebug = 2; // 2 to enable SMTP debug information 
    $mail->SMTPAuth = TRUE; // enable SMTP authentication 
    $mail->SMTPSecure = "tls"; //Secure conection 
    $mail->Port = 587; // set the SMTP port 
    $mail->Username = '**'; // SMTP account username 
    $mail->Password = '**'; // SMTP account password 
    $mail->Priority = 1; // Highest priority - Email priority (1 = High, 3 = Normal, 5 = low) 
    $mail->CharSet = 'UTF-8'; 
    $mail->Encoding = '8bit'; 
    $mail->Subject = 'New Message from Your Strength Coach Contact Page'; 
    $mail->ContentType = 'text/html; charset=utf-8\r\n'; 
    $mail->From = '[email protected]'; 
    $mail->FromName = 'Your Strength Coach'; 
    $mail->WordWrap = 900; // RFC 2822 Compliant for Max 998 characters per line 

    $mail->AddAddress($email); // To: 
    $mail->isHTML(TRUE); 
    $mail->Body = $body; 
    $mail->Send(); 

$nextPage = '../profile'; 
LoginWithCookie($nextPage,$user); 

,而不是繼續其創建的cookie後重定向登錄功能,我得到這個代替:

2017年5月28日19點40分03秒服務器 - >客戶端:220 smtp2.servergrove.com ESMTP 進出口4.72太陽,2017年5月28日19點40分03秒+0000 2017-05- 28 19:40:03客戶服務 - >服務器:EHLO www.yourstrengthcoach.com 2017-05-28 19:40:03 S ERVER - >客戶端:250-smtp2.servergrove.com你好www.yourstrengthcoach.com [38.89.161.133] 250-SIZE 52428800 250 PIPELINING 250-AUTH PLAIN LOGIN 250 STARTTLS 250 HELP 2017年5月28日19:40:03客戶端 - >服務器:STARTTLS 2017-05-28 19:40:03服務器 - > 客戶端:220 TLS繼續2017-05-28 19:40:03客戶端 - >服務器:EHLO www。 yourstrengthcoach.com 2017年5月28日19時40分03秒SERVER - >客戶端: 250-smtp2.servergrove.com你好www.yourstrengthcoach.com [38.89.161.133] 250-SIZE 52428800 250 PIPELINING 250- AUTH PLAIN登錄 250幫助2017-05-28 19:40:03客戶端 - >服務器:AUTH登錄2017-05-28 19:40:03服務器 - > 客戶端:334 VXNlcm5hbWU6 2017-05-28 19:40:03客戶端 - >服務器: aW5mb0B5b3Vyc3RyZW5ndGhjb2FjaC5jb20 = 2017-05-28 19:40:03服務器 - > 客戶端:334 UGFzc3dvcmQ6 2017-05-28 19:40:03客戶端 - >服務器: MEJpZ1NlY3JldCk = 2017-05-28 19:40: 04服務器 - >客戶端:235 身份驗證成功2017-05-28 19:40:04客戶端 - >服務器:郵件 FROM:2017-05-28 19:40:04服務器 - > 客戶端:250 OK -28 19:40:04客戶端 - >服務器:RCPT TO:2017-05-28 19:40:04服務器 - >客戶端:250 接受2017-05-28 19:40:04客戶端 - >服務器:數據2017-05-28 19:40:04 SERVER - > CLIENT:354輸入消息,以「 「。在 行本身2017-05-28 19:40:04客戶端 - >服務器:日期:5月28日,星期日 2017 19:40:03 +0000 2017-05-28 19:40:04客戶端 - >服務器:收件人: [email protected] 2017-05-28 19:40:04客戶端 - >服務器:來自:您的 實力教練2017-05-28 19:40:04客戶端 - >服務器:主題:新消息從你的實力教練聯繫頁面2017-05-28 19:40:04客戶端 - >服務器:消息ID: 2017-05-28 19:40:04客戶端 - >服務器:X-Priority:1 2017-05 -28 19:40:04客戶端 - >服務器:X-Mailer:PHPMailer 5.2.23 (https://github.com/PHPMailer/PHPMailer)2017-05-28 19:40:04客戶端 - > 服務器:MIME版本:1.0 2017-05- 28 19:40:04客戶端 - >服務器: Content-Type:text/html; charset = UTF-8 2017-05-28 19:40:04客戶端 - > 服務器:2017-05-28 19:40:04客戶端 - >服務器:2017-05-28 19:40:04客戶端 - >服務器:您好布賴恩,2017-05-28 19:40:04客戶端 - > 服務器:

2017-05-28 19:40:04客戶端 - >服務器:歡迎來到您的實力教練! 2017-05-28 19:40:04客戶端 - >服務器:

2017-05-28 19:40:04客戶端 - >服務器:感謝您的註冊。我們期待 成爲您健康和健身之旅的一部分。 2017-05-28 19:40:04客戶端 - >服務器:

2017-05-28 19:40:04客戶端 - > 服務器:請務必查看您的 帳戶頁面上的開始使用部分以獲得我們收到的最常見問題的答案。 如果您有任何未解答的問題,請隨時通過電子郵件發送給我們 。您可以通過[email protected]與我們聯繫。 2017-05-28 19:40:04客戶端 - >服務器:

2017-05-28 19:40:04客戶端 - >服務器:再次感謝,
2017-05-28 19:40:04客戶端 - >服務器:布賴恩Gwaltney,創2017年5月28日19時40分04秒 客戶端 - >服務器:

2017年5月28日19時40分04秒CLIENT - > SERVER:一定要檢查我們的Facebook ,Instagram和 Pinterest! 2017-05-28 19:40:04客戶端 - >服務器:2017-05-28 19:40:04客戶端 - > 服務器:。 2017-05-28 19:40:04服務器 - >客戶端:250行 id = 1dF42m-00015y-51 2017-05-28 19:40:04客戶端 - >服務器:退出 2017-05-28 19:40 :04服務器 - >客戶端:221 smtp2.servergrove.com 關閉連接

任何想法發生了什麼問題?

回答

1

郵件部分沒有任何問題。此行:

2017-05-28 19:40:04 SERVER -> CLIENT: 250 OK id=1dF42m-00015y-51 

表示您的郵件服務器成功接受郵件。

可能是一個問題是,在生成輸出(即調試日誌)之後發出的任何頭文件將不會被髮送,因爲那時已經太晚了。如果關閉調試輸出(SMTPDebug = 0),重定向將能夠工作。

+0

工作正常!謝謝! –

相關問題