PHP mail class with complete functions. PHP -- which of the following functions are very powerful? can I send html-format emails and attachments? PhpclassEmail {--- set the global variable var $ mailTo; the recipient var $ mailCC; PHP -- the following class features very powerful, not only can send html emails, but can also send attachments
Class Email {
// --- Set global variables
Var $ mailTo = ""; // recipient
Var $ mailCC = ""; // CC
Var $ mailBCC = ""; // private CC
Var $ mailFrom = ""; // sender
Var $ mailSubject = ""; // topic
Var $ mailText = ""; // subject in text format
Var $ mailHTML = ""; // subject in html format
Var $ mailAttachments = ""; // attachment
/* Function setTo ($ inAddress): address parameter used to process emails $ inAddress
Contains one or more strings. the email address variable uses commas to separate multiple email addresses.
The default return value is true.
**************************************** ******************/
Function setTo ($ inAddress ){
// -- Use the explode () function to separate the email addresses according ","
$ AddressArray = explode (",", $ inAddress );
// -- Check the validity of the email address cyclically
For ($ I = 0; $ I CheckEmail ($ addressArray [$ I]) = false) return false ;}
// -- All valid email addresses are stored in the array
$ This-> mailTo = implode ($ addressArray ,",");
Return true ;}
/*************************************** ***********
The setCC ($ inAddress) function sets the CC email address.
The $ inAddress parameter is a string containing one or more email addresses. it is an email address variable,
Use commas to separate multiple email addresses. the default return value is true.
**************************************** **********************/
Function setCC ($ inAddress ){
// -- Use the explode () function to separate the email addresses according ","
$ AddressArray = explode (",", $ inAddress );
// -- Check the validity of the email address cyclically
For ($ I = 0; $ I CheckEmail ($ addressArray [$ I]) = false) return false ;}
// -- All valid email addresses are stored in the array
$ This-> mailCC = implode ($ addressArray ,",");
Return true ;}
/*************************************** ************
The setBCC ($ inAddress) function sets the parameter $ inAddress to include one or more
Strings of mail addresses, email address variable. use commas to separate multiple mail addresses. the default return value is
True
**************************************** **/
Function setBCC ($ inAddress ){
// -- Use the explode () function to separate the email addresses according ","
$ AddressArray = explode (",", $ inAddress );
// -- Check the validity of the email address cyclically
For ($ I = 0; $ I {If ($ this-> checkEmail ($ addressArray [$ I]) = false)
Return false;
}
// -- All valid email addresses are stored in the array
$ This-> mailBCC = implode ($ addressArray ,",");
Return true;
}
/*************************************** **************************
Function setFrom ($ inAddress): sets the sender address parameter $ inAddress to include emails.
The default return value of an address string is true.
***************************************/
Function setFrom ($ inAddress ){
If ($ this-> checkEmail ($ inAddress )){
$ This-> mailFrom = $ inAddress;
Return true;
} Return false ;}
/**********************
The setSubject ($ inSubject) function is used to set the Mail subject parameter $ inSubject as a string.
Why? Php class Email {// --- set the global variable var $ mailTo =; // The recipient var $ mailCC = ;...