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

Mailtrap transport in mail.md #9960

Draft
wants to merge 1 commit into
base: 11.x
Choose a base branch
from
Draft
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
36 changes: 36 additions & 0 deletions mail.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- [Mail and Local Development](#mail-and-local-development)
- [Events](#events)
- [Custom Transports](#custom-transports)
- [Mailtrap Transport](#mailtrap-transport)
- [Additional Symfony Transports](#additional-symfony-transports)

<a name="introduction"></a>
Expand Down Expand Up @@ -1367,6 +1368,41 @@ Once your custom transport has been defined and registered, you may create a mai
// ...
],

<a name="mailtrap-transport"></a>
### Mailtrap Transport

To use the [Mailtrap](https://mailtrap.io/) driver, install Mailtrap’s PHP SDK via Composer:

# With symfony http client (recommended)
composer require railsware/mailtrap-php symfony/http-client nyholm/psr7

# Or with guzzle http client
composer require railsware/mailtrap-php guzzlehttp/guzzle php-http/guzzle7-adapter

After installing the package, go to your application’s .env file and specify the *MAIL_MAILER* variable as *mailtrap*. Then, define *MAILTRAP_HOST* and *MAILTRAP_API_KEY*, as shown below:

MAIL_MAILER="mailtrap"
# for transactional emails
MAILTRAP_HOST="send.api.mailtrap.io"
MAILTRAP_API_KEY="YOUR_API_KEY_HERE"
# for bulk email sending
MAILTRAP_HOST="bulk.api.mailtrap.io"
MAILTRAP_API_KEY="YOUR_API_KEY_HERE"

Lastly, add Mailtrap to the mailers array in your application's main configuration file (e.g., config/mail.php), like so:

'mailers' => [

// start mailtrap transport
'mailtrap' => [
'transport' => 'mailtrap'
],
// end mailtrap transport

]

To learn more about Mailtrap and see examples, read the [Mailtrap driver documentation](https://github.com/railsware/mailtrap-php/tree/main/src/Bridge/Laravel#usage).

<a name="additional-symfony-transports"></a>
### Additional Symfony Transports

Expand Down