A mail plugin for WordPlate

Installs: 11 328

Dependents: 0

Suggesters: 0

Security: 0

Stars: 15

Watchers: 3

Forks: 5

Open Issues: 0

Type:wordpress-plugin

5.0.0 2020-08-21 06:50 UTC

This package is auto-updated.

Last update: 2020-09-21 07:01:23 UTC


README

mail

A mail plugin for WordPlate.

To send email with WordPress you can use the wp_mail helper method. WordPlate provides a simple way to add custom SMTP credentials and easier working with attachments.

Monthly Downloads Latest Version

Installation

Require the mail package, with Composer, in the root directory of your project.

$ composer require wordplate/mail

Then update the credentials in your .env environment file with your SMTP keys.

MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Then login to the WordPress administrator dashboard and active the plugin.

Name & Address

Optionally you may also specify the global "from" address and name.

MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME=null

Please visit the WordPress documentation to read more about the phpmailer_init action hook.

Attachments

Generally wp_mail only accept a flat array with filenames (or comma separated string), the WordPlate mail plugin allows you to send all variables accepted by PHPMailer, like name, encoding & disposition. The plugin accepts both the old way, with flat array, as well as the the new format, see example below:

wp_mail('marty@mcfly.se', 'Time Travel', 'This is heavy', '', [
    [
        'path' => __DIR__.'/images/beer-image-v1.jpg',
        'name' => 'beer.jpg',
        'encoding' => '8bit',
        'type' => 'image/jpeg',
        'disposition' => 'attachment',
    ],
    [
        'path' => __DIR__.'/images/logo.png',
        'name' => 'logo.jpg',
        'encoding' => 'base64',
        'type' => 'image/png',
        'disposition' => 'inline',
    ],
]);

License

MIT © Vincent Klaiber