Phpmailer Mail Class

Source: Internet
Author: User

<?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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.