Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phalcon\Mailer

Baka email wrapper for Swiftmailer with queue

Configure

SMTP

'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',
        ],
    ],
];

Setup DI

createMessage()

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

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

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

Sending a normal email()

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

Sending a template normal email()

  $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();
];

Sending a normal email instantly, without queue()

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

Events

  • mailer:beforeCreateMessage
  • mailer:afterCreateMessage
  • mailer:beforeSend
  • mailer:afterSend
  • mailer:beforeAttachFile
  • mailer:afterAttachFile

Setup CLI

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;
}

Running CLI

php app.php main mailqueue email_queue

About

PhalconPHP email wrapper for Swiftmailer for sending emails with Queue

Topics

Resources

Stars

4 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages