Skip to content

Commit cad7642

Browse files
author
elbuo8
committed
Merge branch 'master' of github.com:sendgrid/sendgrid-java
2 parents 4caf03f + 9c90048 commit cad7642

File tree

1 file changed

+107
-35
lines changed

1 file changed

+107
-35
lines changed

README.md

Lines changed: 107 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -103,50 +103,106 @@ sendgrid.send(email);
103103

104104
### To
105105

106+
#### addTo
107+
106108
```java
107-
email.addTo("[email protected]");
109+
email.addTo("[email protected]");
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+
email.addCc("[email protected]");
108140
// 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+
110162
```
111163

112164
### From
113165

166+
#### setFrom
167+
114168
```java
115169
email.setFrom("[email protected]");
116170
```
117171

118-
### From Name
172+
#### setFromName
119173

120174
```java
121175
email.setFromName("Other Dude");
122176
```
123177

124-
### Reply To
178+
#### setReplyTo
125179

126180
```java
127181
email.setReplyTo("[email protected]");
128182
```
129183

130-
### Subject
184+
#### setSubject
131185

132186
```java
133187
email.setSubject("Hello World");
134188
```
135189

136-
### Text
190+
#### setText
137191

138192
```java
139193
email.setText("This is some text of the email.");
140194
```
141195

142-
### Html
196+
#### setHtml
143197

144198
```java
145199
email.setHtml("<h1>My first email through SendGrid");
146200
```
147201

148202
### Attachments
149203

204+
#### addAttachment
205+
150206
```java
151207
email.addAttachment("text.txt", "contents");
152208
// or
@@ -157,6 +213,8 @@ email.addAttachment("text.txt", new InputStream(new File("./file.txt")));
157213

158214
### Content IDs
159215

216+
#### addContentId
217+
160218
```java
161219
// First, add an attachment
162220
email.addAttachment("image.png", new File("./image.png"));
@@ -185,25 +243,36 @@ email.getSMTPAPI();
185243

186244
### Recipients
187245

246+
#### addSmtpApiTo
247+
188248
```java
189-
email.addSmtpApiTo("email@email.com");
249+
email.addSmtpApiTo("foo@example.com");
190250
// or
191-
email.addSmtpApiTo(["email@email.com"]);
251+
email.addSmtpApiTo(["[email protected]", "bar@other.com"]);
192252
```
193253

194-
195254
### [Substitutions](http://sendgrid.com/docs/API_Reference/SMTP_API/substitution_tags.html)
196255

256+
#### addSubstitution
257+
197258
```java
198259
email.addSubstitution("key", "value");
199-
// or
260+
261+
JSONObject subs = header.getSubstitutions();
262+
```
263+
264+
#### setSubstitutions
265+
266+
```java
200267
email.setSubstitutions("key", ["value1", "value2"]);
201268

202269
JSONObject subs = header.getSubstitutions();
203270
```
204271

205272
### [Unique Arguments](http://sendgrid.com/docs/API_Reference/SMTP_API/unique_arguments.html)
206273

274+
#### addUniqueAarg
275+
207276
```java
208277
email.addUniqueAarg("key", "value");
209278
// or
@@ -219,37 +288,32 @@ email.setUniqueArgs(map);
219288

220289
JSONObject args = email.getUniqueArgs();
221290
```
291+
222292
### [Categories](http://sendgrid.com/docs/API_Reference/SMTP_API/categories.html)
223293

294+
#### addCategory
295+
224296
```java
225297
email.addCategory("category");
226-
// or
227-
email.addCategory(["categories"]);
228-
// or
229-
email.setCategories(["category1", "category2"]);
230-
// or
231-
email.setCategories(["category1", category2"]);
232298

233299
String[] cats = email.getCategories();
234300
```
235301

236302
### [Sections](http://sendgrid.com/docs/API_Reference/SMTP_API/section_tags.html)
237303

304+
#### addSection
305+
238306
```java
239307
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);
248308

249309
JSONObject sections = email.getSections();
250310
```
251311

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
253317

254318
```java
255319
email.addFilter("filter", "setting", "value");
@@ -258,15 +322,7 @@ email.addFilter("filter", "setting", 1);
258322
JSONObject filters = email.getFilters();
259323
```
260324

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:
270326

271327
```java
272328
SendGrid sendgrid = new SendGrid("sendgrid_username", "sendgrid_password");
@@ -276,6 +332,22 @@ sendgrid.addFilter("bcc", "enabled", 1);
276332
sendgrid.addFilter("bcc", "email", "[email protected]");
277333
```
278334

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+
279351
## Contributing
280352

281353
1. Fork it

0 commit comments

Comments
 (0)