PHP code example of sprintcube / cakephp-elastic-email
1. Go to this page and download the library: Download sprintcube/cakephp-elastic-email 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/ */
sprintcube / cakephp-elastic-email example snippets
Plugin::load('ElasticEmail');
'EmailTransport' => [
...
'elasticemail' => [
'className' => 'ElasticEmail.ElasticEmail',
'apiKey' => 'your-api-key' // your api key
]
]
$email = new Email('elasticemail');
$emailInstance = $email->getTransport();
$emailInstance->setTemplte(123);
$email->send();
$mergeVars = [
'firstname' => 'Foo',
'lastname' => 'Bar',
'title' => 'Good Title'
];
$email = new Email('elasticemail');
$emailInstance = $email->getTransport();
$emailInstance->setMergeVariables($mergeVars);
$email->setFrom(['[email protected]' => 'CakePHP Elastic Email'])
->setTo('[email protected]')
->setEmailFormat('both')
->setSubject('{title} - Email from CakePHP Elastic Email plugin')
->send('Hello {firstname} {lastname}, <br> This is an email from CakePHP Elastic Email plugin.');
$email = new Email('elasticemail');
$emailInstance = $email->getTransport();
$emailInstance->setScheduleTime(60); // after 1 hour from sending time
$email->send();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.