码迷,mamicode.com
首页 > 其他好文 > 详细

在程序中集成发邮件功能

时间:2016-12-25 20:44:19      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:message   username   php   word   utf-8   name   host   customer   for   

<?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 = “10000@qq.com”;
$mail->Password = “***************”;
$mail->Port=25;
$mail->CharSet = “utf-8″;
$mail->From = “10000@qq.com”; //邮件发送者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(‘customer@163.com’, ‘测试邮件功能’, ‘测试邮件功能’);

?>

在程序中集成发邮件功能

标签:message   username   php   word   utf-8   name   host   customer   for   

原文地址:http://www.cnblogs.com/112ba/p/6220426.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!