我正在尝试使用 phpmailer 通过 Qmail 服务器发送电子邮件。发送后,我收到消息“消息已发送”,但没有收到任何消息。这是我的代码:
<?php
require("class.phpmailer.php");
$name = "Purchase Form";
$email_subject = "New Purchase Ticket";
$body = NULL;
foreach ($_REQUEST as $field_name => $value){
if (!empty($value)) $body .= "$field_name = $value\n\r";
}
$mail = new PHPMailer();
$mail->IsQmail();
$mail->FromName = $name;
$mail->AddAddress('*******@*********', 'Purchase Ticket');
$mail->Body = $body;
$mail->IsHTML(false);
$mail->Subject = $email_subject;
if(!$mail->Send())
{ echo "didnt work";
}
else {echo "Message has been sent";}
?>
从命令行我可以输入mail *****@****.com blah blah
并成功发送..