Full-Featured send PHP Mail class

Source: Internet
Author: User
Tags explode split

php--the function of the following class is very powerful, not only can send the HTML format of the message, you can send the attachment
<?php
Class Email {
---set global variables
var $mailTo = ""; Recipient
var $mailCC = ""; Cc
var $mailBCC = ""; Secret CC
var $mailFrom = ""; Sender
var $mailSubject = ""; Theme
var $mailText = ""; Letter Body in text format
var $mailHTML = ""; Letter body in HTML format
var $mailAttachments = ""; Attachment
/* Function Setto ($inAddress): Address parameters for processing messages $inAddress
For inclusion of one or more strings, email address variables, using commas to split multiple email addresses
The default return value is True
**********************************************************/
function Setto ($inAddress) {
--Use the explode () function to split the email address according to ","
$addressArray = Explode (",", $inAddress);
--Check the legality of the email address by looping
For ($i =0 $i <count ($addressArray), $i) {if ($this->checkemail ($addressArray [$i]) ==false) return false;
--all legitimate email addresses are stored in an array
$this->mailto = implode ($addressArray, ",");
return true; }
/**************************************************
function SETCC ($inAddress) set CC email address
Parameter $inAddress is a string containing one or more e-mail addresses, an email address variable,
Use commas to split multiple mail addresses the default return value is True
**************************************************************/
function SETCC ($inAddress) {
--Use the explode () function to split the email address according to ","
$addressArray = Explode (",", $inAddress);
--Check the legality of the email address by looping
For ($i =0 $i <count ($addressArray), $i) {if ($this->checkemail ($addressArray [$i]) ==false) return false;
--all legitimate email addresses are stored in an array
$this-&GT;MAILCC = implode ($addressArray, ",");
return true; }
/***************************************************
function SETBCC ($inAddress) Set the secret cc address parameter $inAddress for inclusion of one or more
mail address of the string, email address variables, using commas to split multiple mail addresses the default return value is
True
******************************************/
function Setbcc ($inAddress) {
--Use the explode () function to split the email address according to ","
$addressArray = Explode (",", $inAddress);
--Check the legality of the email address by looping
for ($i =0; $i <count ($addressArray); $i)
{if ($this->checkemail ($addressArray [$i]) ==false)
return false;
}
--all legitimate email addresses are stored in an array
$this-&GT;MAILBCC = implode ($addressArray, ",");
return true;
}
/*****************************************************************
function Setfrom ($inAddress): Set Sender address parameters $inAddress for inclusion messages
The string default return value of the address is true
***************************************/
function Setfrom ($inAddress) {
if ($this->checkemail ($inAddress)) {
$this->mailfrom = $inAddress;
return true;
return false; }
/**********************
function Setsubject ($inSubject) for setting message subject parameters $insubject to strings

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.