<?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]’, ‘测试邮件功能’, ‘测试邮件功能’);
?>
时间: 2024-10-06 11:05:31