Moony
PHP Framework

Mailing

Pro posílání mailů se využívá service Moony\bootstrap\core\services\Mail a bere nastavení z configu, sekce mail

use Moony\bootstrap\core\services\Mail;
use Moony\bootstrap\core\services\View;
use Moony\bootstrap\core\services\mail\Attachment;
use Moony\bootstrap\core\services\mail\EmbeddedImage;


// Simple mail send
Mail::to('denis@ulmann.it')->send('Subject', 'Mail Content');
Mail::to('denis@ulmann.it')->send('Subject', new View('path/to/template.tpl', [
    'userName' => 'Denis Ulmann',
]));


// Full mail send
Mail::to('denis@ulmann.it')
    ->cc('some@email.em')
    ->bcc('some@email.em')
    ->addAttachment(new Attachment(
        'path/to/file.pdf',
        'Příloha.pdf'
    ))
    ->addEmbeddedImage(new EmbeddedImage(
        'path/to/file.png',
        'embeded_logo'
    ))
    ->send('Subject', 'Content');