();
substitutionData.put("yourContent", "You can add substitution data too.");
transmission.setSubstitutionData(substitutionData);
// Populate Email Body
TemplateContentAttributes contentAttributes = new TemplateContentAttributes();
contentAttributes.setFrom(new AddressAttributes(from));
contentAttributes.setSubject("Your subject content here. {{yourContent}}");
contentAttributes.setText("Your Text content here. {{yourContent}}");
contentAttributes.setHtml("Your HTML content here. {{yourContent}}
");
transmission.setContentAttributes(contentAttributes);
// Send the Email
RestConnection connection = new RestConnection(client, getEndPoint());
Response response = ResourceTransmissions.create(connection, 0, transmission);
logger.debug("Transmission Response: " + response);
}
```
--------------------------------
### Adding SparkPost Java Library Dependency (Maven)
Source: https://github.com/sparkpost/java-sparkpost/blob/master/README.md
This XML snippet shows how to include the SparkPost Java Library as a dependency in a Maven project's pom.xml file. It specifies the groupId, artifactId, and version required for the library.
```XML
com.sparkpost
sparkpost-lib
0.27
```
--------------------------------
### Applying Responsive Styles for Mobile - CSS
Source: https://github.com/sparkpost/java-sparkpost/blob/master/apps/sparkpost-samples-app/samples/richContent.html
This CSS snippet defines responsive styles for email templates, specifically targeting screens with a maximum width of 480px. It adjusts table widths, image sizes, and element display properties to ensure proper rendering on mobile devices.
```CSS
@media(max-width:480px){ table[class=main_table],table[class=layout_table],table[class=header_table]{width:300px !important;} table[class=layout_table] tbody tr td.header_image img{width:300px !important;height:auto !important;} table[class=logo_table],table[class=company_table]{display:block !important;width:220px !important;} table[class=logo_table] tbody tr td,table[class=company_table] tbody tr td{width:220px !important;} table[class=company_table] tbody tr td span{text-align:center !important;} table[class=footer_table] tbody tr td.border_image img{width:300px !important;height:2.5px !important;} }
```
--------------------------------
### Styling Hyperlinks - CSS
Source: https://github.com/sparkpost/java-sparkpost/blob/master/apps/sparkpost-samples-app/samples/richContent.html
This CSS rule sets the color of all anchor () tags to a specific blue shade (#37aadc), ensuring consistent link styling within the email template.
```CSS
a{color:#37aadc}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.