邮件在我的收件箱或垃圾邮件中发送成功但不是Recive

时间:2015-11-17 07:41:50

标签: php ubuntu terminal

我从PHP邮件功能发送邮件,它给了我成功的消息,但邮件没有在电子邮件中恢复。我已经为我的操作系统(Ubuntu)完成了我的gmail POP3 / SMTP / IMAP设置。这是我的代码:

$name = "ali";
$email ="hello";
$message = "adasdasfasf";
$from = 'From: from@gmail.com'; 
$to = 'to@gmail.com'; 
$subject = 'Customer Inquiry';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html\r\n";
$headers = 'From: From: from@gmail.com' . "\r\n" .
    'Reply-To: From: from@gmail.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

if (mail ($to, $subject, $body, $from)) { 
    echo '<p>Your message has been sent!</p>';
} else { 
    echo '<p>Something went wrong, go back and try again!</p>'; 
}

0 个答案:

没有答案