Skip to content

Commit f8d8f9a

Browse files
committed
Move back some text with sandbox exampels
1 parent 4f57f17 commit f8d8f9a

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,47 @@ client.send_batch(
107107
)
108108
```
109109

110+
### Sandbox Sending
111+
112+
Send emails to your Sandbox inbox for testing purposes:
113+
114+
```ruby
115+
require 'mailtrap'
116+
117+
client = Mailtrap::Client.new(api_key: 'your-api-key', sandbox: true, inbox_id: YOUR_INBOX_ID)
118+
client.send(mail)
119+
120+
# You can also pass the request parameters directly
121+
client.send(
122+
from: { email: 'mailtrap@example.com', name: 'Mailtrap Test' },
123+
to: [
124+
{ email: 'your@email.com' }
125+
],
126+
subject: 'You are awesome!',
127+
text: 'Congrats for sending test email with Mailtrap!'
128+
)
129+
```
130+
131+
### Content-Transfer-Encoding
132+
133+
`mailtrap` gem uses Mailtrap API to send emails. Mailtrap API does not try to
134+
replicate SMTP. That is why you should expect some limitations when it comes to
135+
sending. For example, `/api/send` endpoint ignores `Content-Transfer-Encoding`
136+
(see `headers` in the [API documentation](https://railsware.stoplight.io/docs/mailtrap-api-docs/67f1d70aeb62c-send-email)).
137+
Meaning your recipients will receive emails only in the default encoding which
138+
is `quoted-printable`, if you send with Mailtrap API.
139+
140+
For those who need to use `7bit` or any other encoding, SMTP provides
141+
better flexibility in that regard. Go to your _Mailtrap account__Email Sending_
142+
_Sending Domains__Your domain__SMTP/API Settings_ to find the SMTP
143+
configuration example.
144+
145+
### Multiple Mailtrap Clients
146+
147+
You can configure two Mailtrap clients to operate simultaneously. This setup is
148+
particularly useful when you need to send emails using both the transactional
149+
and bulk APIs. Refer to the configuration examples above.
150+
110151
## Supported functionality & Examples
111152

112153
Refer to the [`examples`](examples) folder for more examples:

0 commit comments

Comments
 (0)