PHP - 电子邮件不发送

时间:2013-03-11 18:43:31

标签: php email

首先,我发送给需要简报的人的电子邮件有两个步骤,第二封电子邮件需要发送到info@dirtytrend.com。问题是电子邮件是在第一步发送的,但第二步中的电子邮件永远不会通过,但代码似乎没有任何错误。

代码在

之下
<?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("info@dirtytrend.com", "Subscription Request", $body2)){

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

    }

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

1 个答案:

答案 0 :(得分:0)

在第二个邮件()中你只有3个参数而你错过了第4个参数,所以它可能被识别为垃圾邮件?