<?php
/**
* Mail Class
* Enter description here ...
* @author DF
* Mail::getmail ()->sendmail ();
*
*/
Class mail{
private static $__mail=null;//Mailbox class object
Private $__pmail=null;
function __construct () {
Require (' class.phpmailer.php ');
$this->__pmail=new Phpmailer ();
$this->__pmail->issmtp ();
$this->__pmail->host= "smtp.163.com";
$this->__pmail->username= "";
$this->__pmail->password= "";
$this->__pmail->smtpauth=true;
$this->__pmail->from= "";
}
public static function Getmail () {
/*if (!self::$__mail) {
Self::$__mail=new Mail ();
}
return self::$__mail;
*/
return new Mail ();
}
/**
*
* Enter description here ...
* @param unknown_type $toAddress//recipient address, multiple available, good delimited
* @param unknown_type $fromName//Sender Name
* @param unknown_type $title//title
* @param unknown_type $content//content
* @param unknown_type $isHTML//is sent in HTML format
* @param unknown_type $charset//code
* @param unknown_type $replyto//Recipient address
* @param unknown_type $attachment//Accessories
*/
function SendMail ($toAddress, $title = ', $content = ', $isHTML =true, $charset = ' utf-8 ', $replyto = ', $fromName = ', $ Attachment= ') {
$this->__pmail->ishtml ($isHTML);
$this->__pmail->charset= $charset;
if (Strstr ($toAddress, ', ')) {
$__list=explode (', ', $toAddress);
foreach ($__list as $v) {
$this->__pmail->addaddress ($v, $v);
}
}else{
$this->__pmail->addaddress ($toAddress, $toAddress);
}
$this->__pmail->fromname= $fromName;
$this->__pmail->subject= $title;
$this->__pmail->body= $content;
if ($replyto) {
$this->__pmail->addreplyto ($replyto);
}
if ($attachment) {
$this->__pmail->addattachment ($attachment, $attachment);
}
return $this->__pmail->send ();
}
}
Phpmailer Mail Class