在程序中集成发邮件功能
Posted 371502685
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在程序中集成发邮件功能相关的知识,希望对你有一定的参考价值。
<?php
require_once(“class.phpmailer.php”);
/*发送邮件*/
function sendMail($to, $subject, $message)
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = “smtp.qq.com”;
$mail->SMTPAuth = true;
$mail->Username = “[email protected]”;
$mail->Password = “***************”;
$mail->Port=25;
$mail->CharSet = “utf-8″;
$mail->From = “[email protected]”; //邮件发送者email地址
$mail->FromName = “邮件发送者名称”;
$mail->AddAddress(“$to”, “*****”);
$mail->Subject = $subject; //邮件标题
$mail->Body = $message; //邮件内容
$mail->AltBody = “This is the body in plain text for non-html mail clients”;
return $mail->Send();
}
sendMail(‘[email protected]’, ‘测试邮件功能’, ‘测试邮件功能’);
?>
以上是关于在程序中集成发邮件功能的主要内容,如果未能解决你的问题,请参考以下文章