Giter Site home page Giter Site logo

mail's Introduction

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

mail's People

Contributors

gabbanaesteban avatar josuegrullon avatar kaioken avatar rwhite27 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mail's Issues

Replacing variables without template files

<?php

  $this->mail
            ->to($userInvite->email)
            ->subject($subject)
            ->params(['link' => $invitationUrl])
            ->content($emailTemplate->template)
            ->sendNow();

This is correctly not working, its requires a email template, file , we need this new behavior

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.