This class can be used with the bulk of the email, testing the environment is Linux, the system needs to install SendMail to use
if (! defined (' mail_class_defined ')) {
Define (' mail_class_defined ', 1);
Class Email {
function email ($subject, $message, $senderName, $senderEmail, $toList, $ccList =0, $bccList =0, $replyTo =0) {
$this->sender = $senderName. "< $senderEmail >";
$this->replyto = $replyTo;
$this->subject = $subject;
$this->message = $message;
Define Recipients
if (Is_array ($toList)) {
$this->to = Join ($toList, ",");
} else {
$this->to = $toList;
}
Define CC List
if (Is_array ($ccList) && sizeof ($ccList)) {
$this->CC = Join ($ccList, ",");
} elseif ($ccList) {
$this->cc = $ccList;
}
Define a password cc list
if (Is_array ($bccList) && sizeof ($bccList)) {
$this->BCC = Join ($bccList, ",");
} elseif ($bccList) {
$this->bcc = $bccList;
}
}
Send function
Send email using the mail () function in PHP
function Send () {
Sender
$this->headers = "From:". $this->sender. " ";
Reply to Address
if ($this->replyto) {
$this->headers. = "Reply-to:". $this->replyto. " ";
}
Cc
if ($this->cc) {
$this->headers. = "Cc:". $this->CC. " ";
}
Secret CC
if ($this->bcc) {
$this->headers. = "BCC:". $this->BCC. " ";
}
Return mail ($this->to, $this->subject, $this->message, $this->headers); return results
}
}
}
?>
Description
Parameter description
----------
-The following parameters are required: Subject, message, SenderName, Senderemail and ToList
-These parameters are optional: CCList, Bcclist and ReplyTo
-ToList, CCList and bcclist must be valid email addresses
http://www.bkjia.com/PHPjc/445243.html www.bkjia.com true http://www.bkjia.com/PHPjc/445243.html techarticle This class can be used with the bulk of the email, testing the environment is Linux, the system needs to install SendMail to use if (! defined (' mail_class_defined ')) {define (' Mail_class_ DEFINED ', 1); Class ...