这是我用的SAMPLE<?php require("class.phpmailer.php");$mail = new PHPMailer();$mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "jswan"; // SMTP username $mail->Password = "secret"; // SMTP password$mail->From = "[email protected]"; $mail->FromName = "Mailer"; $mail->AddAddress("[email protected]", "Josh Adams"); $mail->AddAddress("[email protected]"); // name is optional $mail->AddReplyTo("[email protected]", "Information");$mail->WordWrap = 50; // set word wrap to 50 characters $mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments $mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name $mail->IsHTML(true); // set email format to HTML$mail->Subject = "Here is the subject"; $mail->Body = "This is the HTML message body <b>in bold!</b>"; $mail->AltBody = "This is the body in plain text for non-HTML mail clients";if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; }echo "Message has been sent"; ?>
地址应该是对的啊,我把OUTLOOK设置里头的接受邮件服务器和发送邮件服务器都改成我用的IP是可以正常使用的啊!
用你们公司自己的发送服务器却有问题.
你可以自己排除.
1 请确定你发送邮件服务器的地址是否正确
2 请确定你是否开启用户验证.
如果开启,请确定你的用户名和密码是否正确.有的是要求只用户名,有的就需要写整个邮件地址.
3 以上都无误,请确定你的程序所在的服务器,是否被屏蔽,是否有防火墙等等.
require("class.phpmailer.php");$mail = new PHPMailer();$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "jswan"; // SMTP username
$mail->Password = "secret"; // SMTP password$mail->From = "[email protected]";
$mail->FromName = "Mailer";
$mail->AddAddress("[email protected]", "Josh Adams");
$mail->AddAddress("[email protected]"); // name is optional
$mail->AddReplyTo("[email protected]", "Information");$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
$mail->IsHTML(true); // set email format to HTML$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}echo "Message has been sent";
?>
请确定jswan用户名是否正确,而不是[email protected]
自己调试一下吧,按照我4楼的步骤
哦 不好意思 刚刚看错了 我以为你说改检查企业邮箱的设置 PHP服务器应该没问题的呀 不然发163也不可以的吧 我想是不是跟我们公司的邮箱设置有关系啊 如果是邮箱设置问题 咋整喃?