Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation regarding affects-mails #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions docs/tenancy/1.x/affects-mails.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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`.

Expand All @@ -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);
}
}
}
}
Expand Down