palmtree / wp-mailer
WordPress mailer
v1.0.0
2019-03-04 20:57 UTC
Requires
- php: >=5.6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.14
- phpunit/phpunit: ~6.0|~5.7
This package is auto-updated.
Last update: 2024-12-05 19:11:33 UTC
README
Small OOP wrapper around wp_mail()
.
Requirements
- PHP >= 5.6
Installation
Use composer to add the package to your dependencies:
composer require palmtree/wp-mailer
Create the Mailer service, usually using a DI container:
<?php use Palmtree\WordPress\Mailer\Mailer; $mailer = new Mailer('website@example.org', ['bcc@example.org']);
Usage
<?php use Palmtree\WordPress\Mailer\Message; $message = new Message('to@example.org'); $message ->setSubject('Hello!') ->setBody('<p>Hey, this is an HTML email!</p>') ->addCc('cc@example.org') ->addBcc('anotherbcc@example.org'); $message->attach('/path/to/some/file.pdf'); if ($mailer->send($message)) { echo 'Sent!'; } else { echo 'Error sending'; }
License
Released under the MIT license