phpmailer 发送邮件

$smtp =c('SMTP');
include __ROOT__.'/Controller/class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->CharSet = 'UTF-8'; //解决乱码问题
$mail->Host = $smtp['host'];
$mail->Port = $smtp['port'];
$mail->Username = $smtp['username'];
$mail->Password = $smtp['password'];
$mail->SetFrom($smtp['username'], '海软科技');
$mail->Subject = $subject;
$mail->MsgHTML($body);
$mail->AddAddress($to);
return $mail->Send();

发表评论

电子邮件地址不会被公开。 必填项已用*标注