////////////////////////////////////////////////////////////
Emailclass 0.5
Class for sending mail
//
Paul Schreiber
Php@paulschreiber.com
http://paulschreiber.com/
//
Parameters
----------
-Subject, message, SenderName, Senderemail and toList are required
-CCList, Bcclist and replyTo are optional
-ToList, CCList and bcclist can be strings or arrays of strings
(Those strings should be valid email addresses
//
Example
-------
$m = new Email ("Hello there",//Subject
"How is You?",//message body
"Paul",//sender ' s name
"Foo@foobar.com",//sender ' s email
Array ("paul@foobar.com", "foo@bar.com"),//To:recipients
"Paul@whereever.com"//Cc:recipient
);
//
PRint "Mail sent, result was". $m->send ();
//
//
//
if (! defined (' mail_class_defined ')) {
Define (' mail_class_defined ', 1);
Set the To:recipient (s)
if (Is_array ($toList)) {
$this->to = Join ($toList, ",");
} else {
$this->to = $toList;
}
Set the Cc:recipient (s)
if (Is_array ($ccList) && sizeof ($ccList)) {
$this->CC = Join ($ccList, ",");
} elseif ($ccList) {
$this->cc = $ccList;
}
Set the Bcc:recipient (s)
if (Is_array ($bccList) && sizeof ($bccList)) {
$this->BCC = Join ($bccList, ",");
} elseif ($bccList) {
$this->bcc = $bccList;
}
}
Send the message; This is actually just a wrapper for
PHP ' s mail () function; Heck, it's PHP ' s mail function done right:-)
You could override this method to:
(a) Use SendMail directly
(b) do SMTP with sockets
function Send () {
Create the headers needed by PHP ' s mail () function
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