PHP mail class-PHP tutorials with complete functions

Source: Internet
Author: User
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 = ;...

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.