Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/palmtreephp/wp-mailer

Small OOP wrapper around WordPress' wp_mail function
https://github.com/palmtreephp/wp-mailer

Last synced: about 1 month ago
JSON representation

Small OOP wrapper around WordPress' wp_mail function

Awesome Lists containing this project

README

        

# :palm_tree: WordPress Mailer

[![License](http://img.shields.io/packagist/l/palmtree/wp-mailer.svg)](LICENSE)
[![Travis](https://img.shields.io/travis/palmtreephp/wp-mailer.svg)](https://travis-ci.org/palmtreephp/wp-mailer)

Small OOP wrapper around `wp_mail()`.

## Requirements
* PHP >= 5.6

## Installation

Use composer to add the package to your dependencies:
```bash
composer require palmtree/wp-mailer
```

Create the Mailer service, usually using a DI container:

```php
setSubject('Hello!')
->setBody('

Hey, this is an HTML email!

')
->addCc('[email protected]')
->addBcc('[email protected]');

$message->attach('/path/to/some/file.pdf');

if ($mailer->send($message)) {
echo 'Sent!';
} else {
echo 'Error sending';
}
```

## License

Released under the [MIT license](LICENSE)