Following are the settings that can be specified in the filters section of the X-SMTPAPI header. All filters and setting names must be lowercase.
If you’re enabling a Setting, also called a filter, via SMTPAPI, you are required to define all of the parameters for that Setting.
Setting enabled status will always default to your settings on the website, unless otherwise defined in your X-SMTPAPI header
If you enable a disabled setting, our system will not pull your settings for the disabled setting. You will need to define the settings in your X-SMTPAPI header Example: If you have a footer designed but disabled, you can’t just enable it via the API; you need to define the footer in the API call itself.
All filter names and setting names must be lowercase.
For more information on the utility of these settings, please check out the Settings section.
Some Settings are not listed here, because they cannot be defined on a per-message basis. To update these other Settings, please refer to the
Web API Filter Settings commands.
Filter: bcc
Sends a BCC copy of the email created in this transaction to the address specified.
This setting is very powerful, and can only be used on a per-message basis. Use with extreme caution.
Some emails are too important to do normal list management checks, such as password resets or critical alerts. Enabling this filter will bypass the normal unsubscribe / bounce / spam report checks and queue the email for delivery.
Allows you to specify the domain to use to sign messages with DKIM
certification. This domain should match the domain in the From address
of your email.
Parameter Name
Parameter Value
Parameter Description
domain
domain
The domain you would like your DKIM certification signed with
use_from
0 | 1
If enabled, the domain in the From: header of the email will be used to sign your DKIM
Inserts a footer at the bottom of the text and HTML bodies.
Parameter Name
Parameter Value
Parameter Description
enable
0 | 1
Disable or enable this Setting
text/html
string
String containing html body
text/plain
string
String containing text body
Example X-SMTPAPI Header Value
1234567891011
{"filters":{"footer":{"settings":{"enable":1,"text/html":"<p>Thanks,<br />The SendGrid Team<p>","text/plain":"Thanks,\n The SendGrid Team"}}}}
Filter: ganalytics
Re-writes links to integrate with Google Analytics.
Parameter Name
Parameter Value
Parameter Description
enable
0 | 1
Disable or enable this Setting
utm_source
string
Value for the utm_source field
utm_medium
string
Value for the utm_medium field
utm_term
string
Value for the utm_term field
utm_content
string
Value for the utm_content field
utm_campaign
string
Value for the utm_campaign field
Example X-SMTPAPI Header Value
12345678910111213
{"filters":{"ganalytics":{"settings":{"enable":1,"utm_source":"Transactional Email","utm_medium":"email","utm_content":"Reset Your Password","utm_campaign":"Redesigned Transactional Messaging"}}}}
Filter: opentrack
If you don’t use ‘replace’ this will insert an <img> tag at the bottom of the html section of an email which will be used to track if an email is opened. If you choose to use ‘replace’, you can put the tracking pixel wherever you would like in the email and SendGrid will replace it at send time.
Parameter Name
Parameter Value
Parameter Description
enable
0 | 1
Disable or enable this Setting
replace
string
A string to be replaced by SendGrid with the tracking image at send time.
Inserts a subscription management link at the bottom of the text and html bodies or insert the link anywhere in the email.
If you wish to append an unsubscription link, use the text/html and text/plain parameters. However, if you wish to have the link replace a tag (such as [unsubscribe]), use the replace parameter.
Parameter Name
Parameter Value
Parameter Description
enable
0 | 1
Disable or enable this App
text/html
string
HTML to be appended to the email, with the subscription tracking link. You may control where the link is by using a tag like so: <% link text %>
text/plain
string
Text to be appended to the email, with the subscription tracking link. You may control where the link is by using a tag like so: <% %>
replace
string
A tag that will be replaced with the unsubscribe URL (e.g. [unsubscribe_url]). If this parameter is included, it will override text/html and text/plain The URL of the link will be placed at the replace tag’s location, with no html or other formatting.
The landing argument cannot be used in SMTPAPI. It can only be setup via the UI or WebAPI, as an account-level setting.
Example X-SMTPAPI Header Value
1234567891011
{"filters":{"subscriptiontrack":{"settings":{"text/html":"If you would like to unsubscribe and stop receiving these emails <% click here %>.","text/plain":"If you would like to unsubscribe and stop receiving these emails click here: <% %>.","enable":1}}}}
Filter: templates
This setting refers to SendGrid’s transactional templates. SendGrid supports versioning, and the ability to create multiple transactional templates. Previously, we had a Template App, which is now referred to as the Legacy Template App.
This setting refers to our original Email Template app. We now support more fully featured transactional templates. You may create multiple transactional templates that allow for versioning, in addition to several other features.
Wraps a template around your email content. Useful for sending out marketing email and other nicely formatted messages.
Parameter Name
Parameter Value
Parameter Description
enable
0 | 1
Disable or enable this Setting
text/html
string
String containing html content for the template (must contain a <% body %> tag)
Example X-SMTPAPI Header Value
12345678910
{"filters":{"template":{"settings":{"enable":1,"text/html":"<html><head></head><body bgcolor='pink'><div style='width:200px' bgcolor='#FFF'><% body %></div></body></html>"}}}}