Property attributes
The API allows you to specify, add or overwrite attributes for the HTML elements in your document. The attributes specified in your JSON will be directly copied by the API to the element. You must thus be aware that it might break the email lay-out or responsiveness in some clients.
Specify HTML attributes on the email template outer body table
The outer wrapper table acts like the HTML body of your email. Most email clients
will strip out the <body>
tag. That's why most HTML emails, including the emails
generated with this API, have a 100% * 100% outer wrapper table. This enables you
for instance to change the background color surrounding the email, by adding the
property attributes
to the top-level of your JSON document.
{
"templateName" : "My Template",
"attributes" : {
"background" : "red"
}
}
HTML attributes for the inner wrapper table
Emails generated by the responsiveemail.com API have a fixed width of 580px and
are centered on the screen. It is possible to specify HTML attributes for this
580px wrapper table, by setting the property attributes
inside the content
property. The attributes will be directly set on the inner <td>
of this table.
{
"content" : {
"attributes" : {
"cellspacing" : "5",
"cellpadding" : "10"
}
}
}
HTML attributes for individual content blocks
The property attributes
is also available for each block within the content
section of your document. The attributes will be directly applied to the element
customary for this type of block. For instance, in an image block, the css
specified within css
will be directy applied to the html <img>
tag.
{
"type" : "image",
"css" : {
"margin-right" : "10px",
"border" : "2px dashed pink"
}
}
Found a typo?
You can find this documentation page on GitHub.
Propose a change