需要帮助!!! 我在我当前的项目中使用php邮件程序。它成功运行,在成功发送邮件到另一端后,它说来自smtp服务器帐户的邮件不是来自我在这里使用的$ -
$to ="muradautorun@gmail.com";
$from ="tanvir_cse0906@yahoo.com";
我的smtp服务器代码在这里..
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = "muradautorun";
$mail->Password = ""; //my passsword here
这是我的完整代码 -
$to ="muradautorun@gmail.com";
$from ="tanvir_cse0906@yahoo.com";
$from_name="S.M. Murad Hasan Tanvir";
$subject="A sending mail code";
$body ="This is a sending email code, the file attach here is about the coding.";
//here i use gmail as a smtp server
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = "muradautorun";
$mail->Password = ""; //my passsword here
$mail->SetFrom($from, $from_name);
$mail->addAttachment('emailSend.php'); // Add attachment(just the file url)
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($to);
if(!$mail->Send()) {
echo 'Mail error: '.$mail->ErrorInfo;
}
else {
echo 'Message sent!';
}
?>
我做错了,我无法找到,请帮帮我... 提前谢谢。
答案 0 :(得分:0)
您需要允许发送邮件为" tanvir_cse0906@yahoo.com"在你的" muradautorun"首先是gmail帐户。
您可以按照以下步骤执行此操作: