spigandromeda/send-mail-bundle

Mail bundle for Symfony 3 to send mails via SMTP and place a copy in a predefined folder via IMAP


Keywords
mail, smtp, imap
License
MIT

Documentation

SendMailBundle

License Total Downloads

Usage Example

$message = (new \Swift_Message('title'))
    ->setFrom(array('example@domain.de' => 'Full Name'))
    ->setTo('recipent@other-domain.de')
    ->setBody(
        $this->renderView('Mail/mail_template.html.twig'),
        'text/plain'
    );
                
$this->getContainer()->get('spigandromeda.send_mail_service')->sendMail($message);

Configuration config.yml example

send_mail:
    host:               "imap.hoster.de"
    port:               "993"
    encryption:         "tls"
    sent_items_folder:  "Sent Items"
    login:              "example@domain.de"
    password:           "secret"

Installation

Install via Composer

Add the following lines to your composer.json file and then run php composer.phar install or php composer.phar update:

{
    "require": {
        "spigandromeda/send-mail-bundle": "dev-master"
    }
}

Register the bundle

To start using the bundle, register it in app/AppKernel.php:

public function registerBundles()
{
    $bundles = array(
        // Other bundles...
        new SpiGAndromeda\SendMailBundle\SendMailBundle(),
    );
}