A simple wrapper to PHP's native mail function that includes cc, bcc, priority and attachments.
Add a composer.json
file to your project:
{
"require": {
"rcastera/mailer": "v1.0.0"
}
}
Then provided you have composer installed, you can run the following command:
$ composer.phar install
That will fetch the library and its dependencies inside your vendor folder. Then you can add the following to your .php files in order to use the library (if you don't already have one).
require 'vendor/autoload.php';
Then you need to use
the relevant class, and instantiate the class. For example:
require 'vendor/autoload.php';
use rcastera\Email\Mailer;
$mailer = new Mailer();
<?php
require 'vendor/autoload.php';
use rcastera\Email\Mailer;
$mailer = new Mailer();
$mailer = new Mailer();
$mailer->priority(3); // 1 for urgent, 3 for normal.
$mailer->to(array('[email protected]'));
$mailer->cc(array('[email protected]'));
$mailer->bcc(array('[email protected]'));
$mailer->from('John Doe', '[email protected]');
$mailer->subject('This is a test!');
$mailer->body('Hi this is the body of the email.');
$mailer->attach(array('example.zip'));
if ($mailer->send()) {
echo('Email sent!');
} else {
echo('Error sending Email!');
}
unset($mailer);
?>
- Fork it.
- Create a branch (
git checkout -b my_branch
) - Commit your changes (
git commit -am "Added something"
) - Push to the branch (
git push origin my_branch
) - Create an [Issue][1] with a link to your branch
- Enjoy a refreshing Coke and wait