baka / mail
Baka Component for handling email via a simple queue interfase
Installs: 6 460
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 7
Forks: 2
Open Issues: 2
Requires
- php: >=7.0
- ext-phalcon: >=3.0.0
- duncan3dc/fork-helper: ^2.2.0
- phalcon/incubator: >=3.0
- swiftmailer/swiftmailer: ^6
- symfony/var-dumper: ^4.2
Requires (Dev)
- codeception/codeception: 2.5.*
- codeception/verify: 0.4.0
- vlucas/phpdotenv: ^2.0
This package is auto-updated.
Last update: 2025-01-29 05:50:09 UTC
README
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' => 'noreply@domain.do', 'name' => 'YOUR FROM NAME', ], 'debug' => [ 'from' => [ 'email' => 'noreply@domain.do', '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('info@domain.do') ->subject('Test Normal Email queue') ->content('normal email send via queue') ->send(); ];
Sending a template normal email()
$this->mail ->to('info@domain.dom') ->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('info@domain.do') ->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