Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

atelierspierrot/mime-mailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIME Mailer

demonstation documentation A PHP package to send rich MIME emails.

Usage

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()

Installation

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.

Author & License

MIME Mailer

http://github.com/atelierspierrot/mime-mailer

Copyright (c) 2013-2016 Pierre Cassat and contributors

Licensed under the Apache Version 2.0 license.

http://www.apache.org/licenses/LICENSE-2.0


Les Ateliers Pierrot - Paris, France

http://www.ateliers-pierrot.fr/ - [email protected]