PHP code example of thebeaverhead / cakephp-email-cron

1. Go to this page and download the library: Download thebeaverhead/cakephp-email-cron 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/ */

    

thebeaverhead / cakephp-email-cron example snippets


$emailCron = new EmailCron();
$emailCron
    ->setTo('[email protected]')
    ->setTemplate('email/template/path')
    ->setSubject('Email subject')
    ->setSendDate(1580108540)
    ->setData([
        'topic' => [
            'title' => 'foo'
        ], 
        'comments' => [
            ['text' => 'foo'], 
            ['text' => 'bar']
        ]
    ])
    ->add();

$emailCron = new EmailCron();
$emailCron
    ->setTo('[email protected]')
    ->setTemplate('email/template/path')
    ->setSubject('Email subject')
    ->setSendDate(1580108540)
    ->setData([
        'topic' => [
            'title' => 'foo'
        ],
    ])
    ->setIncrementData([
        'comments' => [
            ['text' => 'foo'], 
            ['text' => 'bar']
        ]
    ])
    ->addIncrement();

// Increment notification has been created
// in 10 sec new comment has been added to the same topic
sleep(10);

$emailCron
    ->setIncrementData([
        'comments' => [
            ['text' => 'baz'], 
        ]
    ])
    ->addIncrement();


/**
 * @var \App\View\AppView $this 
 * @var array $comments
 * @var \App\Model\Entity\Comment $comment
 * @var \App\Model\Entity\Topic $topic
 */

'EmailCron' => [
  'send_delay' => 60
],