diff --git a/docs/tenancy/1.x/affects-mails.md b/docs/tenancy/1.x/affects-mails.md index a5a44645..08592c03 100644 --- a/docs/tenancy/1.x/affects-mails.md +++ b/docs/tenancy/1.x/affects-mails.md @@ -30,9 +30,9 @@ The purpose of this package is to allow the sending of emails though a tenant's **Events & Methods** - `Tenancy\Affects\Mails\Events\ConfigureMails` - - `replaceSwiftMailer` + - `replaceSymfonyTransport` -> All other calls you do to the event, will be forwarded to the `Mailer `. +> All other calls you do to the event, will be forwarded to the `Mailer`. ## Installation @@ -47,8 +47,8 @@ Register the following ServiceProvider: - `Tenancy\Affects\Mails\Provider::class` ## Configuration -After the installation of the package, all you have to do is configure the package in the way you want. Like most affects, this package will fire an event `Tenancy\Affects\Mails\Events\ConfigureMails`, which will provide you with some functionality to change or update the `Swift_Mailer` used: -- `replaceSwiftMailer()`, this will change the default mailer to the one provided. +After the installation of the package, all you have to do is configure the package in the way you want. Like most affects, this package will fire an event `Tenancy\Affects\Mails\Events\ConfigureMails`, which will provide you with some functionality to change or update the `TransportInterface` used: +- `replaceSymfonyTransport()`, this will change the default mailer to the one provided. > All the calls you do to the event, will be forwarded to the `Mailer`. @@ -66,11 +66,19 @@ class ConfigureTenantMails { if($tenant = $event->event->tenant) { - // Set the "From" Field - $event->alwaysFrom($tenant->email_from, $tenant->email_name); + // Check if the alwaysFrom method exists: it does not exists on Laravel's fake + if(method_exists($event->mailer, 'alwaysFrom')) + { + // Set the "From" Field + $event->alwaysFrom($tenant->email_from, $tenant->email_name); + } - // Optionally add the "ReplyTo" Field - $event->alwaysReplyTo($tenant->mail_replyto, $tenant->mail_replyto_name); + // Check if the alwaysReplyTo method exists: it does not exists on Laravel's fake + if(method_exists($event->mailer, 'alwaysReplyTo') + { + // Optionally add the "ReplyTo" Field + $event->alwaysReplyTo($tenant->mail_replyto, $tenant->mail_replyto_name); + } } } }