2013-01-31 32 views
1

我真的被卡住了。我生成的電子郵件具有爲信封發件人設置的無人apache地址。無法讓信封發件人設置正確,電子郵件在Gmail中轉到垃圾郵件

這裏是我的PHP代碼:包括第2行

<?php 
$subject = "XXXClient Dashboard - Password Reset Request Received"; 
$headers .= "From: XXX Alert <".$from.">\r\n" . "Reply-To: XXXSupport  <[email protected]>\r\n" . "X-Mailer: PHP/" . phpversion() . "\r\nX-originating-IP: XXX.167.43.105\r\n"; 
$headers .= "MIME-Version: 1.0\r\n"; 
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; 

$body = $email_header . ' 
    <h1 style="color: #666666;font-weight: normal;font-size: 18px;text-align: center;padding: 0;margin: 0;">We have recieved a request to reset your password. </h1> 
    <p>Hello, 
    <br> 
    Your new temporary password is <b>' . $passwordresult . 
    '</b>. You may logon to the <a style="color:#8A2BE2; text-decoration:none; font-weight:bold;" href="'. $site_url . '">XX Client Dashboard</a> with your email address and temporary password, then visit the profile section where you can choose a new password.</p> 

' . $email_footer; 
?> 

下面是我收到的電子郵件源

$to = $emailresult; 
    include 'inc/msg/resetpassword.php'; 
    if(mail($to, $subject, $body, $headers, '-f' . $from)) { 
     echo 'A temporary password has been sent to ' . $emailresult . '. Please check your inbox and logon with your new password'; 
     } else { 
     echo("Message delivery failed..."); 
     } 

文件:http://pastebin.com/nbGUaHP1

工作細到我的工作電子郵件,但是當我發送到Gmail時,它總是會發送垃圾郵件。我有正確設置-f標誌,但它不想更改信封發件人,所以我認爲這是問題。任何人都知道爲什麼信封發件人不會設置此代碼?

+2

請勿使用郵件()或建立您自己的mime電子郵件。 mail()是垃圾,建立自己的啞劇是痛苦的。只需使用PHPMailer或Swiftmailer,讓您的生活更輕鬆。 –

回答

0

我正在編輯我的代碼的錯誤部分。我最終得到它的工作。即使使用信封發件人和SPF通行證,我仍然在gmail垃圾郵件文件夾中登陸哪種類型。

相關問題