nattreid / mailing
Mailing for Nette Framework
1.2.1
2019-03-04 11:23 UTC
Requires
- php: >= 7.1
- nattreid/latte: ~1.0
- nette/application: ~2.4
- nette/di: ~2.4
- nette/mail: ~2.4
Requires (Dev)
- nette/tester: ~1.7
- tracy/tracy: ~2.4
README
Nastavení v config.neon
extensions: - NAttreid\Mailing\DI\MailingExtension mailing: sender: 'sender <info@test.cz>' variables: # v latte mailu promenne title: 'Test.cz' supportEmail: 'support@mail.com' mailer: - App/Mailer - App/Mailer2('sender2 <info2@test.cz>')
Použití
Vytvořte třídu děděním z \NAttreid\Mailing\BaseMailer
class Mailer extends \NAttreid\Mailing\BaseMailer { /** * Odeslani linku pro zmenu hesla * @param string $email * @param string $hash */ public function sendRestorePassword($email, $hash) { $mail = $this->createMail('template'); // nebo $mail = $this->createMailFromString('<body><p>sablona jako string</p></body>); $mail->link = $this->link('someLink', [ 'hash' => $hash ]); $mail->setSubject('translateMessage') ->addTo($email); $mail->send(); }
Odeslání
/** @var \App\Services\Mailer @inject */ public $mailer; $this->mailer->sendRestorePassword($email, $hash);