问题
Can any one please tell me how to add unsubscribe link in the mail which is send by modifying the header.I am using Sendgrid header XSMTPAPI, although I found a relevant header called subscription track in the filters, but couldn't figure out how to use it.
回答1:
You would want to have an X-SMTPAPI
header that looked something like this when broken out:
{
filters: {
subscriptiontrack: {
settings: {
enable: 1,
"text/html": "Unsubscribe <%Here%>",
"text/plain": "Unsubscribe Here: <% %>"
}
}
}
}
When you're sending the request, make sure you stringify the JSON for the header:
X-SMTPAPI: '{"filters":{"subscriptiontrack":{"settings":{"enable":1,"text/html":"Unsubscribe <%Here%>","text/plain":"Unsubscribe Here: <% %>"}}}}'
Also, as a side note, all of this can be found on the docs page for the X-SMTPAPI
header:
- http://sendgrid.com/docs/API_Reference/SMTP_API/index.html
- http://sendgrid.com/docs/API_Reference/SMTP_API/apps.html
来源:https://stackoverflow.com/questions/16147030/to-give-unsubscribe-link-in-the-mail-using-sendgrid-xsmtpapi-header