dev-master
9999999-dev
GPL-3.0 BSD-3-Clause GPL-2.0
The Requires
0.1.0
0.1.0.0
GPL-3.0 BSD-3-Clause GPL-2.0
The Requires
composer require rixxi/mail-message-template
extensions: rixxiMailMessageTemplate: Rixxi\Mail\DI\MessageTemplateExtension
Create template with subject, body and html body. All parts are optional., (*1)
{subject}Welcome to our site {$user->name}{/subject} {body} Oh how we are so grateful {$user->name} that you decided to join our awesome service. Sincerly, yours CEO Only Man in the Company {/body} {body html} {* text is default *} <marquee>Oh how we are so grateful {$user->name} that you decided to join our awesome service.<marquee>Sincerly,
{/body}
yours CEO
Only Man in the Company , (*2)
$message = $messageFactory->createFromFile(__DIR__ . '/../mails/registration.latte', array( 'user' => (object) array( 'name' => 'Name Surname', ), )); // message will have set subject, body and its html alternative // setup other stuff and send $message->addTo($user->email); $message->setFrom('example@example.com'); $this->sender->send($message); \\ ...
Creating from file template will allow you to utilize Nette\Mail\Message
auto-inlining of template content for html body.
You can alternatively use createFromString
for creating message from string., (*3)
GPL-3.0 BSD-3-Clause GPL-2.0
GPL-3.0 BSD-3-Clause GPL-2.0