File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,38 @@ client.send(
73
73
74
74
```
75
75
76
+ ### Batch Sending
77
+
78
+ Send up to 500 emails in one API call:
79
+
80
+ ``` ruby
81
+ require ' mailtrap'
82
+
83
+ client = Mailtrap ::Client .new (api_key: ' your-api-key' )
84
+
85
+ batch_base = Mailtrap ::Mail .batch_base_from_content(
86
+ from: {
email: ' [email protected] ' ,
name: ' Mailtrap Test' },
87
+ subject: ' You are awesome!' ,
88
+ text: ' Congrats for sending test email with Mailtrap!' ,
89
+ html: ' <p>Congrats for sending test email with Mailtrap!</p>'
90
+ )
91
+
92
+ client.send_batch(
93
+ batch_base, [
94
+ Mailtrap ::Mail .from_content(
95
+ to: [
96
+ {
email: ' [email protected] ' ,
name: ' John Doe' }
97
+ ]
98
+ ),
99
+ Mailtrap ::Mail .from_content(
100
+ to: [
101
+ {
email: ' [email protected] ' ,
name: ' Jane Doe' }
102
+ ]
103
+ )
104
+ ]
105
+ )
106
+ ```
107
+
76
108
### Email Templates API
77
109
78
110
``` ruby
@@ -94,6 +126,7 @@ Refer to the [`examples`](examples) folder for more examples:
94
126
95
127
- [ Full] ( examples/full.rb )
96
128
- [ Email template] ( examples/email_template.rb )
129
+ - [ Batch Sending] ( examples/batch.rb )
97
130
- [ ActionMailer] ( examples/action_mailer.rb )
98
131
- [ Email Templates API] ( examples/email_templates_api.rb )
99
132
You can’t perform that action at this time.
0 commit comments