Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bakaphp/mail
PhalconPHP email wrapper for Swiftmailer for sending emails with Queue
https://github.com/bakaphp/mail
beanstalkd mail phalcon phalcon-php phalconphp queue
Last synced: about 1 month ago
JSON representation
PhalconPHP email wrapper for Swiftmailer for sending emails with Queue
- Host: GitHub
- URL: https://github.com/bakaphp/mail
- Owner: bakaphp
- License: mit
- Created: 2018-02-22T00:17:38.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-29T22:35:58.000Z (over 4 years ago)
- Last Synced: 2024-04-22T00:20:36.444Z (8 months ago)
- Topics: beanstalkd, mail, phalcon, phalcon-php, phalconphp, queue
- Language: PHP
- Size: 59.6 KB
- Stars: 4
- Watchers: 7
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Phalcon\Mailer
Baka email wrapper for Swiftmailer with queue
## Configure
**SMTP**
```php
'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()**
```php
$di->set('mail', function () use ($config, $di) {//setup
$mailer = new \Baka\Mail\Manager($config->email->toArray());return $mailer->createMessage();
});
```**Sending a normal email()**
```php
$this->mail
->to('[email protected]')
->subject('Test Normal Email queue')
->content('normal email send via queue')
->send();
];```
**Sending a template normal email()**
```php
$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()**
```php
$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
```php
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`