Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

SMTP Filters


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.

(information)

Info

  • If you're enabling a Setting, also called a filter, via SMTPAPI, you are required to define all of the parameters for that Setting.
  • 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.

(information)

Info

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

filter-bcc page anchor
(error)

Danger

Due to low usage, this setting has been removed. Click here for more information.

Sends a BCC copy of the email created in this transaction to the address specified.

Parameter NameParameter ValueParameter Description
enable0 | 1Disable or enable this Setting
emailemailemail address destination for the bcc message

_10
{
_10
"filters": {
_10
"bcc": {
_10
"settings": {
_10
"enable": 1,
_10
"email": "example@example.com"
_10
}
_10
}
_10
}
_10
}


Filter: bypass_list_management

filter-bypass_list_management page anchor
(error)

Danger

This setting is very powerful, and can only be used on a per-message basis. Use with extreme caution. To learn more about the more granular bypass settings available in the v3 Mail Send API, see our Suppressions Overview documentation.

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.

Parameter NameParameter ValueParameter Description
enable0 | 1Disable or enable this Setting

_10
{
_10
"filters": {
_10
"bypass_list_management": {
_10
"settings": {
_10
"enable": 1
_10
}
_10
}
_10
}
_10
}


Rewrites links in email text and html bodies to go through our webservers, allowing for tracking when a link is clicked on.

Parameter NameParameter ValueParameter Description
enable0 | 1Disable or enable this Setting
enable_texttrue | falseEnable or Disable click-tracking links in the Plain-Text portion of the message.

Example X-SMTPAPI Header Value

example-x-smtpapi-header-value page anchor

_10
{
_10
"filters": {
_10
"clicktrack": {
_10
"settings": {
_10
"enable": 1,
_10
"enable_text": true
_10
}
_10
}
_10
}
_10
}


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 NameParameter ValueParameter Description
domaindomainThe domain you would like your DKIM certification signed with
use_from0 | 1If enabled, the domain in the From: header of the email will be used to sign your DKIM

Example X-SMTPAPI Header Value

example-x-smtpapi-header-value-2 page anchor

_10
{
_10
"filters": {
_10
"dkim": {
_10
"settings": {
_10
"domain": "example.com",
_10
"use_from": false
_10
}
_10
}
_10
}
_10
}

Example X-SMTPAPI Header Value

example-x-smtpapi-header-value-3 page anchor

_11
{
_11
"filters": {
_11
"footer": {
_11
"settings": {
_11
"enable": 1,
_11
"text/html": "<p>Thanks,<br />The SendGrid Team<p>",
_11
"text/plain": "Thanks,\n The SendGrid Team"
_11
}
_11
}
_11
}
_11
}


Re-writes links to integrate with Google Analytics.

Parameter NameParameter ValueParameter Description
enable0 | 1Disable or enable this Setting
utm_sourcestringValue for the utm_source field
utm_mediumstringValue for the utm_medium field
utm_termstringValue for the utm_term field
utm_contentstringValue for the utm_content field
utm_campaignstringValue for the utm_campaign field

Example X-SMTPAPI Header Value

example-x-smtpapi-header-value-4 page anchor

_13
{
_13
"filters": {
_13
"ganalytics": {
_13
"settings": {
_13
"enable": 1,
_13
"utm_source": "Transactional Email",
_13
"utm_medium": "email",
_13
"utm_content": "Reset Your Password",
_13
"utm_campaign": "Redesigned Transactional Messaging"
_13
}
_13
}
_13
}
_13
}


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 NameParameter ValueParameter Description
enable0 | 1Disable or enable this Setting
replacestringA string to be replaced by SendGrid with the tracking image at send time.

Example X-SMTPAPI Header Value

example-x-smtpapi-header-value-5 page anchor

_10
{
_10
"filters": {
_10
"opentrack": {
_10
"settings": {
_10
"enable": 1,
_10
"replace": "%opentrack%"
_10
}
_10
}
_10
}
_10
}


(error)

Danger

Due to low usage, this setting has been removed. Click here for more information.

Tests message with SpamAssassin(link takes you to an external page) to determine if it is spam, and drop it if it is.

Parameter NameParameter ValueParameter Description
enable0 | 1Disable or enable this Setting
maxscore1 to 10.0Score after which the message will be dropped (default is 5.0, higher scores indicate higher likelihood of spam)
urlurlan optional url to POST the email and a copy of the report to. Refer to the Spam Checker documentation(link takes you to an external page) for POST details.

Example X-SMTPAPI Header Value

example-x-smtpapi-header-value-6 page anchor

_11
{
_11
"filters": {
_11
"spamcheck": {
_11
"settings": {
_11
"enable": 1,
_11
"maxscore": 3.5,
_11
"url": "http://example.com/compliance"
_11
}
_11
}
_11
}
_11
}


Filter: subscriptiontrack

filter-subscriptiontrack page anchor

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 NameParameter ValueParameter Description
enable0 | 1Disable or enable this App
text/htmlstringHTML 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/plainstringText to be appended to the email, with the subscription tracking link. You may control where the link is by using a tag like so: <% %>
replacestringA 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.
(error)

Danger

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

example-x-smtpapi-header-value-7 page anchor

_11
{
_11
"filters": {
_11
"subscriptiontrack": {
_11
"settings": {
_11
"text/html": "If you would like to unsubscribe and stop receiving these emails <% click here %>.",
_11
"text/plain": "If you would like to unsubscribe and stop receiving these emails click here: <% %>.",
_11
"enable": 1
_11
}
_11
}
_11
}
_11
}


(information)

Info

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.

Uses a transactional template when sending an email.

Parameter NameParameter ValueParameter Description
enable0 | 1Disable or enable this Setting
template_idstringThe ID of the template to use when sending a message, represented by a string.

Example X-SMTPAPI Header Value

example-x-smtpapi-header-value-8 page anchor

_10
{
_10
"filters": {
_10
"templates": {
_10
"settings": {
_10
"enable": 1,
_10
"template_id": "5997fcf6-2b9f-484d-acd5-7e9a99f0dc1f"
_10
}
_10
}
_10
}
_10
}


(error)

Danger

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 NameParameter ValueParameter Description
enable0 | 1Disable or enable this Setting
text/htmlstringString containing html content for the template (must contain a <% body %> tag)

Example X-SMTPAPI Header Value

example-x-smtpapi-header-value-9 page anchor

_10
{
_10
"filters": {
_10
"template": {
_10
"settings": {
_10
"enable": 1,
_10
"text/html": "<html><head></head><body bgcolor='pink'><div style='width:200px' bgcolor='#FFF'><% body %></div></body></html>"
_10
}
_10
}
_10
}
_10
}


Rate this page: