phpmailer 发送邮件实例代码
时间:2014-06-09 16:40来源: 作者: 点击:
次
phpmailer 发送邮件实例代码 header( Content-type:text/html;charset=utf-8 ); include ( phpmailer/class.phpmailer.php ); include ( phpmailer/class.smtp.php ); $mail = new PHPMailer(); $mail -IsSMTP(); //setmailertouseSMTP $mail -Host= smtp.sohu.
phpmailer 发送邮件实例代码
- header("Content-type:text/html;charset=utf-8");
- include('phpmailer/class.phpmailer.php');
- include('phpmailer/class.smtp.php');
- $mail = new PHPMailer();
-
- $mail->IsSMTP();
- $mail->Host = "smtp.sohu.com";
- $mail->Port = 25;
- $mail->SMTPAuth = true;
- $mail->Username = "yourmail@sohu.com";
- $mail->Password = "yourmail168";
- $mail->From = "spr_zsql@163.com";
- $mail->FromName = "test";
- $mail->AddAddress("yourmail@qq.com", "test");
- $mail->WordWrap = 50;
-
-
- $mail->IsHTML(true);
- $mail->Subject = "测试";
- $mail->Body = "测试";
- if(!$mail->Send())
- {
- echo "Mailer Error: " . $mail->ErrorInfo;
- echo "发送邮件错误!";
- }else{
- echo "邮件发送成功!";
- }
(责任编辑:admin) |
------分隔线----------------------------