From 8abba8f431d5b5e014ea75e3e30504bd0ffca10e Mon Sep 17 00:00:00 2001 From: tudormarciu Date: Thu, 17 Oct 2024 12:37:10 +0300 Subject: [PATCH] Mailtrap transport in mail.md Add Mailtrap Transport instructions to mail.md --- mail.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/mail.md b/mail.md index 2798dad7bf..55c21d73bd 100644 --- a/mail.md +++ b/mail.md @@ -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) @@ -1367,6 +1368,41 @@ Once your custom transport has been defined and registered, you may create a mai // ... ], + +### 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). + ### Additional Symfony Transports