本文介绍下,使用phpmailer发送yahoo邮件的例子,有需要的朋友,参考下吧。phpmailer类发邮件的例子:
issmtp();//邮件服务器$mail->host = smtp.mail.yahoo.com.cn;$mail->smtpdebug = 0;//使用smpt验证$mail->smtpauth = true;//smtp验证的用户名称$mail->username = ********@yahoo.cn;//smtp验证的秘密$mail->password = y*********;//设置编码格式$mail->charset = utf-8;//设置主题$mail->subject = 测试;//$mail->altbody = to view the message, please use an html compatible email viewer!;//设置发送者$mail->setfrom('*******@yahoo.cn', 'test');//采用html格式发送邮件$mail->msghtml($body);//接受者邮件名称$mail->addaddress(*********@yahoo.com, test);//发送邮件if(!$mail->send()) { echo mailer error: . $mail->errorinfo;} else { echo message sent!;}?>
需要引入phpmailer类文件,下载地址:phpmailer邮件发送类v5.1下载地址。
