PHP code example of motsmanish / cakephp-mailgun
1. Go to this page and download the library: Download motsmanish/cakephp-mailgun library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
motsmanish / cakephp-mailgun example snippets
composer
'EmailTransport' => [
'default' => [
...
],
'mailgun' => [
'className' => 'MailgunEmail\Mailer\Transport\MailgunTransport'
],
],
'Email' => [
'default' => [
...
],
'mailgun' => [
'transport' => 'mailgun',
'mailgun_domain' => 'example.com', //
// load Email class
use Cake\Mailer\Email;
// send mail by setting all the My Site'])
->to('[email protected] ')
->subject('Hello')
//->template('get_in_touch')
//->viewVars(['to' => 'You', 'from' => 'Me'])
//->emailFormat('both')
->addHeaders(['o:tag' => 'testing'])
->addHeaders(['o:deliverytime' => strtotime('+1 Min')])
->addHeaders(['v:my-custom-data' => json_encode(['max' => 'testing'])])
->readReceipt('[email protected] ')
->returnPath('[email protected] ')
->attachments([
'cake_icon1.png' => Configure::read('App.imageBaseUrl') . 'cake.icon.png',
'cake_icon2.png' => ['file' => Configure::read('App.imageBaseUrl') . 'cake.icon.png'],
WWW_ROOT . 'favicon.ico'
])
->send('How are you?');