smtp发送邮件
2017-02-08 11:28:53
使用PHPMAIL类库
require("../tabs/inc/mail/class.phpmailer.php");
$mail = new PHPMailer(true);
//$address = 'magnetech@vip.163.com';
$address = 'linzhimao001@gmail.com';//要发送的地址
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Port = 25;
$mail->Host = "mail.etobao.com"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
//$mail->Username = "testmyweb@163.com"; // SMTP username
$mail->Username = "mail";//账号名称
$mail->Password = "123456"; // SMTP password
$mail->From = "mail@system.mail";
$mail->FromName = "mail@system.mail";
$mail->AddAddress("$address", "");
$mail->Subject = "From Customes";
$mail->Body = $message;
$mail->WordWrap = 80; // set word wrap
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "
";
//echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "";
发表评论: