quextum / emails
Sending email
1.0.10
2022-06-08 08:28 UTC
Requires
- php: >=8.0
- ext-json: *
- latte/latte: ^2.10
- nette/application: ^3.1
- nette/caching: ^3.0
- nette/http: ^3.0
- nette/mail: ^3.1
- nette/schema: ^1.0
- nette/utils: ^3.0
- tracy/tracy: ^2.6
Requires (Dev)
- nette/bootstrap: ^3.1
- nette/di: ^3.0
- nette/tester: ^2.0
README
Konfigurace
V konfiguračním souboru config.neon registrujte rozšíření:
extensions: emails: App\Emails\EmailsExtension
Poté rozšíření nastavte. Ukázková konfigurace:
parameters: domain: domain.com title: Title emails: templates: '%appDir%/emails/templates' default: from: [noreply@%domain%, %title%] password < default: subject: Nastavení hesla na stránkách %domain% variables: imagesUrl: https://cdn.domain.com/xyz/ registration < default: subject: Byl jste přidán do systému %domain% notification < default: subject: Notifikace ze systému %domain% contact < default: subject: Zpráva z kontaktního formuláře serveru %domain% attachment: - %appDir%/emails/assets/about_blank.pdf embed: - %appDir%/emails/assets/prosky-logo.png to: test@email.cz: Jan Novák - test2@email.com - "Jan Novák <test3@email.com>"
Nastavit je možné:
to
from
subject
cc
bcc
reply
return
embed
attachment
Použití:
V presenteru:
$this->context->getService('emails')->send('registration', ['to' => $user->email],['userEntity'=> $user]);
Parametry:
- Typ. Je nutné aby pro specifikovaný typ existovala konfigurace a šablona se schodným názvem.
- Nastavení. Toto nastavení se spojí s definovaným nastavením v konfiguraci. Nastavení v parametru metody má větší váhu něž konfigurační soubor.
- Proměnné šablony.