2013-03-11 213 views
0

我發送的郵件首先發送給想要通訊的人,第二封郵件需要發送到[email protected]。問題在於電子郵件是在第一步發送的,但第二步中的電子郵件永遠不會通過,但代碼似乎沒有任何錯誤。PHP - 電子郵件不發送

的代碼如下

<?php 


$name = $_POST["nameofperson"]; 
$to = $_POST["emailofperson"]; 
$subject = "Hi!"; 
$body = "Hi " . $name . ",<br><br>Thank you for subscribing?\n\nWe have logged your email to process your newsletter and you will recieve an email from us confirming your subscription."; 

$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 


if (mail($to, $subject, $body, $headers)) { 



    $body2 = "Name: " . $name . "\n"; 
    $body2 .= "Email: " . $to; 
    if(mail("[email protected]", "Subscription Request", $body2)){ 

     header("Location: http://www.dirtytrend.com/events.html"); 
    } 
    else{ 

    } 

} else { 
    echo "ERROR: Email not sent please contact the system administrator"; 
} 
?> 
+3

因爲您在第二個'mail'中忘記了標題? – 2013-03-11 18:46:30

+0

可能是您收到此電子郵件爲垃圾郵件。請檢查一次。 – Kabir 2013-03-11 18:49:33

回答

0

在第二郵件()中只有3個參數,你就錯過了一個4號與頭,所以也許會被識別爲垃圾郵件?