Skip to content

Commit 3ac92d5

Browse files
committed
Document multiple Mailtrap clients configuration
1 parent cfa233b commit 3ac92d5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Diff for: README.md

+24
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,30 @@ better flexibility in that regard. Go to your _Mailtrap account_ → _Email Send
8282
_Sending Domains__Your domain__SMTP/API Settings_ to find the SMTP
8383
configuration example.
8484

85+
### Multiple Mailtrap Clients
86+
87+
You can configure two Mailtrap clients to operate simultaneously. This setup is
88+
particularly useful when you need to send emails using both the transactional
89+
and bulk APIs. Refer to the configuration example below:
90+
91+
```ruby
92+
# config/application.rb
93+
ActionMailer::Base.add_delivery_method :mailtrap_bulk, Mailtrap::ActionMailer::DeliveryMethod
94+
95+
# config/environments/production.rb
96+
config.action_mailer.delivery_method = :mailtrap
97+
config.action_mailer.mailtrap_settings = {
98+
api_key: 'your-api-key'
99+
}
100+
config.action_mailer.mailtrap_bulk_settings = {
101+
api_key: 'your-api-key',
102+
bulk: true
103+
}
104+
105+
# app/mailers/foo_mailer.rb
106+
mail(delivery_method: :mailtrap_bulk)
107+
```
108+
85109
## Migration guide v1 → v2
86110

87111
Change `Mailtrap::Sending::Client` to `Mailtrap::Client`.

0 commit comments

Comments
 (0)