-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7984473
commit f574eaa
Showing
1 changed file
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,11 +49,11 @@ The `from` method from `MultiMail` needs a string of an email provided in `confi | |
|
||
This example assumes that `[email protected]` and `[email protected]` have been specified in `config/multimail.php`. | ||
|
||
// Send Mail - send mail from [email protected], receiver should be specified in mailable | ||
\MultiMail::from('[email protected]')->send(new \App\Mail\Invitation($user, $form)); | ||
// Send mail from [email protected] | ||
\MultiMail::to($user)->from('[email protected]')->send(new \App\Mail\Invitation($user)); | ||
|
||
// Send Mail with optional parameters 'to' and 'locale' from malaccount [email protected] | ||
\MultiMail::to('[email protected]')->from('[email protected]')->locale('en')->send(new \App\Mail\Invitation($user)); | ||
// Send from malaccount [email protected] | ||
\MultiMail::to($user)->from('[email protected]')->locale('en')->send(new \App\Mail\Invitation($user)); | ||
|
||
### Queued Mails | ||
|
||
|
@@ -144,6 +144,38 @@ You may provide `default` credentials inside the `email` array from `config/mult | |
|
||
When `first_mail_password` and `first_mail_username` are empty, `[email protected]` will use credentials specified by `default`. This is useful for your local development, when you want to send all mains from one mailaccount while testing. | ||
|
||
#### Specify everything in mailable | ||
|
||
You may set `to`, `cc`, `bcc`, `locale` and `from` in your mailable class. In this case, you could reduce the basic example from above to: | ||
|
||
// Send mail from [email protected] | ||
\MultiMail::send(new \App\Mail\Invitation($user)); | ||
|
||
Mailable: | ||
|
||
/** | ||
* Create a new message instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct($user) | ||
{ | ||
$this->to = $user; | ||
$this->fromMailer = '[email protected]' | ||
$this->locale('en'); | ||
} | ||
|
||
/** | ||
* Build the message. | ||
* | ||
* @return $this | ||
*/ | ||
public function build() | ||
{ | ||
return $this->markdown('emails.invitation') | ||
->subject('Invitation mail') | ||
} | ||
|
||
### Advice | ||
|
||
#### Production environment | ||
|
@@ -156,3 +188,4 @@ Do not specify any email acounts in your local `.env`. Otherwise you may risk to | |
Instead use `log` driver or setup a fake mail SMTP account like [mailtrap](https://mailtrap.io/) or similar services. | ||
|
||
If you want to use a fake mail SMPT account for testing, it is not needed to specifiy the same credentials for any email account. Instead, simply provide a default mail account (see above `Default mailaccount`). | ||
|