To give unsubscribe link in the mail using sendgrid XSMTPAPI header

随声附和 提交于 2019-12-10 15:45:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!