@@ -103,50 +103,106 @@ sendgrid.send(email);
103
103
104
104
### To
105
105
106
+ #### addTo
107
+
106
108
``` java
107
-
109
+
110
+ // or
111
+
112
+ // or
113
+ email
. addTo(
" [email protected] " ,
" Foo Bar" );
114
+ ```
115
+
116
+ #### setTo
117
+
118
+ ``` java
119
+
120
+ ```
121
+
122
+ #### addToName
123
+
124
+ ``` java
125
+ email. addToName(" Foo" );
126
+ // or
127
+ email. addToName([" Foo" , " Bar" ]);
128
+ ```
129
+
130
+ #### setToName
131
+
132
+ ``` java
133
+ email. setToName([" Foo" , " Bar" ]);
134
+ ```
135
+
136
+ #### addCc
137
+
138
+ ``` java
139
+
108
140
// or
109
- email
. setTo([
" [email protected] " ]);
141
+
142
+ ```
143
+
144
+ #### setCc
145
+
146
+ ``` java
147
+
148
+ ```
149
+
150
+ #### addBcc
151
+
152
+ ``` java
153
+ email
. addBcc(
" [email protected] " );
154
+ // or
155
+
156
+ ```
157
+
158
+ #### setBcc
159
+
160
+ ``` java
161
+
110
162
```
111
163
112
164
### From
113
165
166
+ #### setFrom
167
+
114
168
``` java
115
169
email
. setFrom(
" [email protected] " );
116
170
```
117
171
118
- ### From Name
172
+ #### setFromName
119
173
120
174
``` java
121
175
email. setFromName(" Other Dude" );
122
176
```
123
177
124
- ### Reply To
178
+ #### setReplyTo
125
179
126
180
``` java
127
181
email
. setReplyTo(
" [email protected] " );
128
182
```
129
183
130
- ### Subject
184
+ #### setSubject
131
185
132
186
``` java
133
187
email. setSubject(" Hello World" );
134
188
```
135
189
136
- ### Text
190
+ #### setText
137
191
138
192
``` java
139
193
email. setText(" This is some text of the email." );
140
194
```
141
195
142
- ### Html
196
+ #### setHtml
143
197
144
198
``` java
145
199
email. setHtml(" <h1>My first email through SendGrid" );
146
200
```
147
201
148
202
### Attachments
149
203
204
+ #### addAttachment
205
+
150
206
``` java
151
207
email. addAttachment(" text.txt" , " contents" );
152
208
// or
@@ -157,6 +213,8 @@ email.addAttachment("text.txt", new InputStream(new File("./file.txt")));
157
213
158
214
### Content IDs
159
215
216
+ #### addContentId
217
+
160
218
``` java
161
219
// First, add an attachment
162
220
email. addAttachment(" image.png" , new File (" ./image.png" ));
@@ -185,25 +243,36 @@ email.getSMTPAPI();
185
243
186
244
### Recipients
187
245
246
+ #### addSmtpApiTo
247
+
188
248
``` java
189
- email. addSmtpApiTo(" email@email .com" );
249
+ email. addSmtpApiTo(" foo@example .com" );
190
250
// or
191
- email. addSmtpApiTo([" email@email .com" ]);
251
+ email
. addSmtpApiTo([
" [email protected] " , " bar@other .com" ]);
192
252
```
193
253
194
-
195
254
### [ Substitutions] ( http://sendgrid.com/docs/API_Reference/SMTP_API/substitution_tags.html )
196
255
256
+ #### addSubstitution
257
+
197
258
``` java
198
259
email. addSubstitution(" key" , " value" );
199
- // or
260
+
261
+ JSONObject subs = header. getSubstitutions();
262
+ ```
263
+
264
+ #### setSubstitutions
265
+
266
+ ``` java
200
267
email. setSubstitutions(" key" , [" value1" , " value2" ]);
201
268
202
269
JSONObject subs = header. getSubstitutions();
203
270
```
204
271
205
272
### [ Unique Arguments] ( http://sendgrid.com/docs/API_Reference/SMTP_API/unique_arguments.html )
206
273
274
+ #### addUniqueAarg
275
+
207
276
``` java
208
277
email. addUniqueAarg(" key" , " value" );
209
278
// or
@@ -219,37 +288,32 @@ email.setUniqueArgs(map);
219
288
220
289
JSONObject args = email. getUniqueArgs();
221
290
```
291
+
222
292
### [ Categories] ( http://sendgrid.com/docs/API_Reference/SMTP_API/categories.html )
223
293
294
+ #### addCategory
295
+
224
296
``` java
225
297
email. addCategory(" category" );
226
- // or
227
- email. addCategory([" categories" ]);
228
- // or
229
- email. setCategories([" category1" , " category2" ]);
230
- // or
231
- email. setCategories([" category1" , category2" ]);
232
298
233
299
String [] cats = email. getCategories();
234
300
```
235
301
236
302
### [ Sections] ( http://sendgrid.com/docs/API_Reference/SMTP_API/section_tags.html )
237
303
304
+ #### addSection
305
+
238
306
``` java
239
307
email. addSection(" key" , " section" );
240
- // or
241
- Map newSec = new HashMap();
242
- newSec.put(" - section- " , " value" );
243
- email.setSections(newSec);
244
- // or
245
- JSONObject newSec = new JSONObject();
246
- newSec.put(" - section- " , " value" );
247
- email.setSections(newSec);
248
308
249
309
JSONObject sections = email. getSections();
250
310
```
251
311
252
- ### [Filters](http://sendgrid.com/docs/API_Reference/SMTP_API/apps.html)
312
+ ### [ Filters / Apps] ( http://sendgrid.com/docs/API_Reference/SMTP_API/apps.html )
313
+
314
+ You can enable and configure Apps.
315
+
316
+ #### addFilter
253
317
254
318
``` java
255
319
email. addFilter(" filter" , " setting" , " value" );
@@ -258,15 +322,7 @@ email.addFilter("filter", "setting", 1);
258
322
JSONObject filters = email. getFilters();
259
323
```
260
324
261
- ### Get Headers
262
-
263
- ```java
264
- String headers = email.jsonString();
265
- ```
266
-
267
- ### Filters/Apps
268
-
269
- You can enable and configure Apps.
325
+ Example enabling bcc app:
270
326
271
327
``` java
272
328
SendGrid sendgrid = new SendGrid (" sendgrid_username" , " sendgrid_password" );
@@ -276,6 +332,22 @@ sendgrid.addFilter("bcc", "enabled", 1);
276
332
sendgrid
. addFilter(
" bcc" ,
" email" ,
" [email protected] " );
277
333
```
278
334
335
+ ### [ ASM - Advanced Supression Manager] ( https://sendgrid.com/docs/User_Guide/advanced_suppression_manager.html )
336
+
337
+ #### setASMGroupId
338
+
339
+ ``` java
340
+ email. setASMGroupId(1 );
341
+ ```
342
+
343
+ ### [ Schedule Sending] ( https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html )
344
+
345
+ #### setSendAt
346
+
347
+ ``` java
348
+ email. setSendAt(1409348513 );
349
+ ```
350
+
279
351
## Contributing
280
352
281
353
1 . Fork it
0 commit comments