@@ -42,14 +42,14 @@ public static void main(String[] args) throws SparkPostException, IOException {
42
42
}
43
43
44
44
private void runApp () throws SparkPostException , IOException {
45
- client = this .newConfiguredClient ();
45
+ this . client = this .newConfiguredClient ();
46
46
String template = this .getTemplate ("richContent.html" );
47
47
createTemplate (template , SAMPLE_TEMPLATE_NAME );
48
48
}
49
49
50
50
/**
51
51
* Demonstrates how to store an email template in SparkPost
52
- *
52
+ *
53
53
* @throws SparkPostException
54
54
*/
55
55
public void createTemplate (String html , String name ) throws SparkPostException {
@@ -62,11 +62,12 @@ public void createTemplate(String html, String name) throws SparkPostException {
62
62
TemplateContentAttributes content = new TemplateContentAttributes ();
63
63
64
64
content .setSubject ("Template Test" );
65
- content .setFrom (new AddressAttributes (client .getFromEmail (), "me" , null ));
65
+ content .setFrom (new AddressAttributes (this . client .getFromEmail (), "me" , null ));
66
66
content .setHtml (html );
67
+ content .setText ("Template Test Text" );
67
68
template .setContent (content );
68
69
69
- IRestConnection connection = new RestConnection (client , getEndPoint ());
70
+ IRestConnection connection = new RestConnection (this . client , getEndPoint ());
70
71
try {
71
72
TemplateCreateResponse response = ResourceTemplates .create (connection , template );
72
73
String templateId = response .getResults ().getId ();
@@ -88,7 +89,7 @@ private void showTemplatePreview(String templateId, IRestConnection connection)
88
89
saveToFile (response .getResults ().getHtml (), path );
89
90
90
91
try {
91
- openWebpage (new URI ("file://" + path ));
92
+ PreviewTemplateSample . openWebpage (new URI ("file://" + path ));
92
93
} catch (URISyntaxException e ) {
93
94
e .printStackTrace ();
94
95
}
0 commit comments