复制代码 代码如下:
function mailto($nickname, $address, $id, $activation_code)
{
date_default_timezone_set('PRC');
include_once("class.phpmailer.php");
$mail = new PHPMailer(); // defaults to using php "mail()"
$mail->IsSMTP();
$mail->Host = "smtp.163.com"; // SMTP 服务器
$mail->SMTPAuth = true; // 打开SMTP 认证
$mail->Username = "nowamagic@163.com"; // 用户名
$mail->Password = "yourpassword"; // 密码
//$body = file_get_contents('application/views/nmra/register.html');
//$body = preg_replace('//////','', $body); //Strip backslashes
$body = '<p><body></p>';
$body .= '<div>';
$body .= '<div><img src="images/phpmailer.gif"></div>';
$body .= '<p>'.$nickname.',您好。</p>';
$body .= '<p>恭喜你成为简明现代魔法研究协会的第'.$id.'名会员。</p>';
$body .= '<p>现代魔法研究协会(NowaMagic Research Association)是一个程序猿、攻城狮、设计狮和开发者们技术交流、话题讨论的社区。希望在这里你能找到感兴趣的话题与志同道合的朋友。</p>';
$body .= '请点击以下链接验证您的邮箱,请注意域名为nowamagic.net:<a href="http://www.nowamagic.net/librarys/accounts/activation/?code="'.$activation_code.'" target="_blank">?code='.$activation_code.'</a>';
$body .= '<p>顺祝工作学习愉快,生活舒心。</p>';
$body .= '</div></body>';
//echo $body;
$mail->AddReplyTo("nowamagic@163.com","Gonn");
$mail->SetFrom('nowamagic@163.com', 'Gonn');
$mail->AddReplyTo("nowamagic@163.com","Gonn");
$address = "252211974@qq.com";
//$address = "nowamagic@gmail.com";
$mail->AddAddress($address, $nickname);
$subject = "收到来自简明现代魔法的邮件";
$mail->Subject = "=?UTF-8?B?".base64_encode($subject)."?=";
// optional, comment out and test
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->MsgHTML($body);
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
}
else {
//echo "Message sent!";
}
}
新闻热点
疑难解答