<?php
/*
 * Plugin Hook: mail
 * Plugin Name: PHPMailer
 * Author: 系统自带插件
 * Version: 1.0
 * Plugin URI: about:blank
 * Description: 通过PHPMailer类库发送邮件,请修改plugins/PHPMailer/config.php文件中的相关参数。
 */
if(!defined('IN_MICECMS')){header("HTTP/1.0 404 Not Found");die();}
function PHPMailer($mailto,$title,$body)
{
	$dir=str_replace('\\','/', dirname(__FILE__)).'/';
	include_once $dir."config.php";
	$sendresult='本站暂不支持找回密码功能，请直接联系本站管理员';
	
	include_once $dir.'class.phpmailer.php';
	try {  $mail = new PHPMailer(true); 
		$mail->IsSMTP();                           // 启用SMTP  
		$mail->SMTPAuth   = true;                  // 启用SMTP认证  
		
		$mail->Host       = $mail_smtp; // SMTP server  
		$mail->Port       = $mail_smtp_port; // 端口  
		$mail->Username   = $mail_username; //SMTP server username
		$mail->Password   = $mail_pwd; // SMTP server password  
		$mail->AddReplyTo($mail_username,$mail_name);  //发件人信息  
		$mail->From       = $mail_username;//发件人地址  
		$mail->FromName   = $mail_name;   //发件人名称

		$mail->AddAddress($mailto);   
		$mail->Subject  = $title;   //标题   
		$mail->WordWrap   = 80; // set word wrap  
		$mail->CharSet	= 'utf-8';
		$mail->MsgHTML($body);	//邮件内容  
		$mail->IsHTML(true); // send as HTML  
		$mail->Send();
		$sendresult="密码已发送到您的邮箱,请登录您的邮箱"; 
	} catch (phpmailerException $e) {  
		$sendresult=$e->errorMessage().'请直接联系本站管理员';
	}

	return	$sendresult;
}
?>