电子邮件不是从PHP发送到电子邮件地址

时间:2015-07-27 05:51:17

标签: php email

美好的一天!我已经尝试并搜索了我能找到的所有内容..但无济于事,代码仍无效,我甚至没有收到任何错误消息。我对我的变量没有问题,我认为它在“邮件”部分。请帮忙。

require "Mail.php";
$from = 'angelsofmaryacademy@gmail.com';
$to = $hidden1;
$subject = $hidden2;
$body = $_POST['replytomsg'];

$host = "smtp.gmail.com";
$port = "465";
$user = "angelsofmaryacademy@gmail.com";
$pass = "Ang3lsofmaryacademy";


$headers = array ("From" => $from, "To" => $to, "Subject" => $subject);

$smtp = @Mail::factory("smtp",array(
                       "host" => $host,
                       "port" => $port,
                       "auth" =>true,   
                       "username" => $user,
                       "password" => $pass));


$mail = $smtp->send($to, $headers, $body);


if (PEAR::isError($mail)) {
  echo ('<p>'. $mail->getMessage() . '</p>');
}
else {
   echo ('<p>Message successfully sent! </p>');
} 

}

0 个答案:

没有答案