-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathExample.java
80 lines (60 loc) · 2.46 KB
/
Example.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import com.sendgrid.smtpapi.SMTPAPI;
public class Example {
public static void main(String[] args) {
SMTPAPI header = new SMTPAPI();
// [To](http://sendgrid.com/docs/API_Reference/SMTP_API/index.html)
header.addTo("[email protected]");
// or
//header.addTo(["[email protected]"]);
// or
//header.setTos(["[email protected]", "[email protected]"]);
//String[] tos = header.getTos();
// [Substitutions](http://sendgrid.com/docs/API_Reference/SMTP_API/substitution_tags.html)
header.addSubstitution("key", "value");
//JSONObject subs = header.getSubstitutions();
// [Unique Arguments](http://sendgrid.com/docs/API_Reference/SMTP_API/unique_arguments.html)
header.addUniqueArg("key", "value");
// or
//Map map = new HashMap<String, String>();
//map.put("unique", "value");
//header.setUniqueArgs(map);
// or
//JSONObject map = new JSONObject();
//map.put("unique", "value");
//header.setUniqueArgs(map);
//JSONObject args = header.getUniqueArgs();
// [Categories](http://sendgrid.com/docs/API_Reference/SMTP_API/categories.html)
header.addCategory("category");
// or
//header.addCategory(["categories"]);
// or
//header.setCategories(["category1", "category2"]);
//String[] cats = header.getCategories();
// [Sections](http://sendgrid.com/docs/API_Reference/SMTP_API/section_tags.html)
header.addSection("key", "section");
// or
//Map newSec = new HashMap();
//newSec.put("-section-", "value");
//header.setSections(newSec);
// or
//JSONObject newSec = new JSONObject();
//newSec.put("-section-", "value");
//header.setSections(newSec);
//JSONObject sections = header.getSections();
// [Filters](http://sendgrid.com/docs/API_Reference/SMTP_API/apps.html)
header.addFilter("filter", "setting", "value");
//header.addFilter("filter", "setting", 1);
//JSONObject filters = header.getFilters();
// [ASM Group Id](https://sendgrid.com/docs/User_Guide/advanced_suppression_manager.html)
header.setASMGroupId(1);
//Integer groupId = header.getASMGroupId();
// [Scheduling](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)
header.setSendAt(1416427645);
//int sendAt = header.getSendAt();
// Get Headers
String headers = header.jsonString();
// If you need the unescaped JSON string.
//String rawJson = header.rawJsonString();
System.out.println(headers);
}
}