A PHP package to send rich MIME emails.
To create a Mailer instance, just write:
$mailer = \MimeMailer\Mailer::getInstance();
You can define a set of user options writing:
$mailer = \MimeMailer\Mailer::getInstance(array(
'options name' => 'option value',
//...
));
The Mailer
instance acts like a global container to build messages and send them. It handles
a set of messages as an array. From this container, you can access to:
$mailer->getMessage() // the current message object
$mailer->getTransporter() // the current transporter object
$mailer->getSpooler() // the current spooler object
To work on current message, you can write:
$mailer->getMessage() // the message will be created if none was defined
->setTo(...)
->setSubject(...)
->setText(...)
//...
;
Many methods are defined to build a message, please refer to the PHP class itself to learn more.
All "persons" fields can be defined as the followings:
( '[email protected]' )
( '[email protected]', 'my name' )
( array( 'my name'=>'[email protected]' ) )
( array( 'my name'=>'[email protected]', 'another name'=>'[email protected]' ) )
( array( 'my name'=>'[email protected]', '[email protected]' ) )
Finally, to send built messages, just write:
$mailer->send()
Some logs are accessibles from the container with:
$mailer->getErrors()
$mailer->getInfos()
For a complete information about how to install this package and load its namespace, please have a look at our USAGE documentation.
If you are a Composer user, just add the package to the
requirements of your project's composer.json
manifest file:
"atelierspierrot/mime-mailer": "@stable"
You can use a specific release or the latest release of a major version using the appropriate version constraint.
Please note that this package depends on the externals PHP Patterns, PHP Library and PHP Validators.
MIME Mailer
Copyright (c) 2013-2016 Pierre Cassat and contributors
Licensed under the Apache Version 2.0 license.
Les Ateliers Pierrot - Paris, France