Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
70% | Total: 645 This week: 1 | All time: 4,960 This week: 34 |
Version | License | PHP version | Categories | |||
php-mail-sending 1.0.2 | GNU General Publi... | 5.5 | HTML, Email, PHP 5 |
Description | Author | |
This class can send HTML email messages with attachments. |
This is the main include file for all the example. You will have to redefine two variables here before trying to run the examples :
Contains files that are used as attachments by the attachments.Php example script.
Contains two images that are embedded in the html contents of several example scripts.
Html file that contains mail contents used by the external-html.php example script.
Sends an email with only a text part (no html contents).
Sends an email with both text and html parts.
Sends an email containing embedded images. Html contents are given by a string.
Sends an email whose html contents come from an external file, mail.html. The html contents reference two embedded images.
Sends an email with embedded images and attachments (coming from the data/ directory).
The Mail class is yet-another PHP mailer, with the following features :
The Mail* class requires the Adavanced Regex package, located here :
http://www.phpclasses.org/package/9336-PHP-Match-MSDOS-UNIX-patterns-with-regular-expressions.html
File Regex.class.php has been provided here for your convenience, but this may not be the latest version.
You can have a look at the examples/ directory, to have an overview of the various usages of this class. The file examples/README.md explains how the examples are organized, and which example does what.
The basic usage of the Mail class is fairly simple ; the following example will send a plain text mail with subject "Mail subject", and contents "Mail contents", to the address "someone@example.com" :
$mail = new Mail ( false, "someone@example.com", "Mail subject", "Mail contents" ) ;
$mail -> Send ( ) ;
An exception will be thrown if something goes wrong.
The Mail class constructor has the following signature :
$mail = new Mail ( $from = false, $to = false, $subject = false, $text = false, $html = false, $html_base = false ) ;
It creates an instance of the class, and any parameters defined in the constructor can be specified later by using properties.
Parameters are the following
Adds the specified addresses to the recipient list.
The function's parameters can be any number of strings or arrays of strings containing the addresses.
Duplicate addresses will be ignored.
Example :
$mail -> AddRecipient ( 'me@example.com', [ 'person1@example.com', 'person2@example.com' ] ) ;
You can also manually append addresses to the To property but in this case, there will be no checking on duplicates :
$mail -> To [] = 'me@example.com' ;
$mail -> To [] = 'person1@example.com' ; // etc.
Adds addresses to Carbon Copy recipients.
Behaves as the AddRecipient() method. You can also manually append addresses to the CC property.
Adds addresses to Blind Carbon Copy recipients (ie, the recipients added by the AddRecipient() and AddCC() methods won't know that there are additional recipients specified as BCC).
Behaves as the AddRecipient() method. You can also manually append addresses to the BCC property.
Adds a MIME header or replaces an existing one.
Adds an attachment to the current mail. The $name parameter indicates the attachment file name that will be shown to the recipient when he will open its mail. If not specified, the filename portion of the $path parameter will be used.
Returns the mail contents as plain text, including MIME headers, text and base64-encoded attachments.
Html contents can be specified in two ways : either by specifying some value for the $html parameter of the class constructor, or setting later the Html property.
The LoadHtml() method provides a third way to load html contents, from an external file. This file can be a regular html page using <html>, <head> and <body> tags (or not) ; the following contents will be extracted from it to form the mail's html part :
The $base\_path parameter indicates the root path for searching external images referenced by html contents.
Sends the mail using the standard PHP mail() function.
An exception will be thrown if something goes wrong.
Validates an email by verifying the following elements :
It also provides default values for certain fields :
An array containing the Blind Carbon Copy recipients.
The preferred way of adding new BCC recipients is by using the AddBCC() method, which performs additional checkings, such as ignoring duplicate addresses.
An array containing the Carbon Copy recipients.
The preferred way of adding new CC recipients is by using the AddCC() method, which performs additional checkings, such as ignoring duplicate addresses.
MIME character set used for building mail contents. The default is ISO8859-1.
Email address where error messages coming from mail servers will be sent.
Sender's email address.
Html part of the mail contents.
Base path to be used for retrieving images referenced by the html contents.
Email address to be used when the recipient will reply to the mail.
Email address for the return path.
Email address to be used for read receipts.
Character set used in the source html contents.
Mail subject.
Plain text part of the message contents.
An array containing the list of recipients.
The preferred way of adding new recipients is by using the AddRecipient() method, which performs additional checkings, such as ignoring duplicate addresses.
Files (17) |
File | Role | Description | ||
---|---|---|---|---|
examples (8 files, 2 directories) | ||||
LICENSE | Lic. | License text | ||
Mail.phpclass | Class | Class source | ||
NOTICE | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
Regex.class.php | Class | Class source |
Files (17) | / | examples |
File | Role | Description | ||
---|---|---|---|---|
data (2 files) | ||||
images (2 files) | ||||
attachments.php | Example | Example script | ||
embedded-images.php | Example | Example script | ||
examples.inc.php | Aux. | Auxiliary script | ||
external-html.php | Example | Example script | ||
mail.html | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
text-and-html.php | Example | Example script | ||
textonly.php | Example | Example script |
Files (17) | / | examples | / | data |
Files (17) | / | examples | / | images |
File | Role | Description |
---|---|---|
image1.jpg | Icon | Icon image |
image2.jpg | Icon | Icon image |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | User Comments (1) | ||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.