dev-master
9999999-dev https://github.com/Lennaert/cakephp3-mandrillMandrill Email Transport for CakePHP 3
MIT
The Requires
- php >=5.4.16
- cakephp/cakephp ~3
cakephp mandrill
Mandrill Email Transport for CakePHP 3
This is a Mandrill Email Transport plugin for CakePHP 3. To use, you'll need to have an active Mandrill account, set up with the email address you'll be sending from, and an API key
., (*1)
To install this plugin, you're best off using composer. Add:, (*2)
"lennaert/cakephp3-mandrill": "*"
to your composer.json
file and run., (*3)
CakePHP uses profiles and transports to set up your email configuration. In your configuration file (app.php
or your own), add configuration arrays for the Mandrill profile and transport. The profile (first array) is the default settings for any Mandrill email, which keeps your email settings DRY. The second array is the Transport config, telling Cake where to find and how to use the Mandrill plugin. There are many more options you can set in the profile array below., (*4)
'Email' => [ 'Mandrill' => [ 'template' => 'default', 'layout' => 'default', 'transport' => 'Mandrill', 'emailFormat' => 'both', 'from' => ['you@yours.com' => 'Bob Bobbington'], 'sender' => ['you@yours.com' => 'Bob Bobbington'], 'Mandrill' => [ 'preserve_recipients' => true ] ] ], 'EmailTransport' => [ 'Mandrill' => [ 'className' => 'MandrillEmail\Network\Email\MandrillTransport', 'host' => 'smtp.mandrillapp.com', 'key' => '-----your-key-here-----' ] ]
Add the namespaces for emails and Mandrill:, (*5)
use MandrillEmail\Network\Email\MandrillTransport; use Cake\Network\Email\Email;
Then, create an Email, tell it which profile to use, tell it where to go and that's it!, (*6)
$emailObject ->subject('Mandrill sends emails') ->profile('Mandrill') // This is the profile you set above, in your config file ->to('me@mine.com', 'Mary Maristone') ->send();
If you're having trouble sending emails, make sure your from
address is the email address set up in Mandrill., (*7)
Mandrill Email Transport for CakePHP 3
MIT
cakephp mandrill