PHP code example of baka / mail

1. Go to this page and download the library: Download baka/mail 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/ */

    

baka / mail example snippets


'email' => [
    'driver' => 'smtp',
    'host' => getenv('EMAIL_HOST'),
    'port' => getenv('EMAIL_PORT'),
    'username' => getenv('EMAIL_USER'),
    'password' => getenv('EMAIL_PASS'),
    'from' => [
        'email' => '[email protected]',
        'name' => 'YOUR FROM NAME',
    ],
    'debug' => [
        'from' => [
            'email' => '[email protected]',
            'name' => 'YOUR FROM NAME',
        ],
    ],
];

$di->set('mail', function () use ($config, $di) {

    //setup
    $mailer = new \Baka\Mail\Manager($config->email->toArray());

    return $mailer->createMessage();
});

  $this->mail
    ->to('[email protected]')
    ->subject('Test Normal Email queue')
    ->content('normal email send via queue')
    ->send();
];


  $this->mail
    ->to('[email protected]')
    ->subject('Test Template Email queue')
    ->params(['name' => 'test'])
    ->template('email.volt') //you can also use template() default template is email.volt
    ->send();
];


  $this->mail
    ->to('[email protected]')
    ->subject('Test Normal Email now')
    ->content('send normal email now')
    ->sendNow();
];



use Phalcon\Cli\Task;

/**
 * Class LsTask
 * @description('List directory content', 'The content will be displayed in the standard output')
 */
class MainTask extends Task
{
    use Baka\Mail\JobTrait;
}