Sendgrid-python: Styling the unsubscribe link after setting the ASM group for transactional templates

Created on 20 Jul 2016  路  8Comments  路  Source: sendgrid/sendgrid-python

Issue Summary

We've been able to create an unsubscribe link for any email sent using a transactional template but we've been unable to get the unsubscribe link to appear in the location we want using substitution tags. The unsubscribe links just appear at the bottom of the email.

Here's a list of tags we've tried:

[unsubscribe]
%unsubscribe%
<%unsubscribe%>
%asm_preferences_url%
<%asm_preferences_url%>

Here's a screenshot of how it's showing up:

image

Steps to Reproduce

Here's out code to send the email:

email = sendgrid.Mail(to=rep_email, from_email="[email protected]", from_name="Support")

email.add_filter('templates', 'enable', '1')

email.add_filter('templates', 'template_id', 'our-template-id')
email.add_substitution("$addon", addon)
email.add_substitution("$firstname", first_name)
email.add_substitution("$purchaseurl", purchase_link)
email.set_html(' ')
email.set_text(' ')
email.set_subject(' ')
email.set_asm_group_id(981)
sg.send(email)

Technical details:

  • sendgrid-python Version: 2.2.1
  • Python Version: 2.7
question

Most helpful comment

@mdavoodi and @thinkingserious , I ended up making it work with the<%asm_group_unsubscribe_raw_url%> and <%asm_preferences_raw_url%> tags.

The problem I was facing was happening because I switched from "CODE" to "DESIGN" before saving the template. When I did that, it changed the < and > for < and > and that change caused the problem.

When I did add the tags and saved the template while still in "CODE" mode, it worked :D

All 8 comments

Hello @mdavoodi,

Thanks for reaching out to us.

I believe the unsubscribe link is modified as described here: https://sendgrid.com/docs/Classroom/Track/Unsubscribes/unsubscribe_via_subscription_tracking.html

If you continue to have issues, please contact our support team at https://support.sendgrid.com

With Best Regards,

Elmer

@mdavoodi did you manage to do this? I'm having the same problem here and it won't be fixed with @thinkingserious's solution...

Hi @danielweinmann,

I suggest you reach out to our support team at https://support.sendgrid.com. They will be happy to help. Thanks!

@danielweinmann no, that didn't work the way I wanted it too. I ended up keeping the un-styled links at the bottom. If you figure out a better solution please let me know.

@mdavoodi and @thinkingserious , I ended up making it work with the<%asm_group_unsubscribe_raw_url%> and <%asm_preferences_raw_url%> tags.

The problem I was facing was happening because I switched from "CODE" to "DESIGN" before saving the template. When I did that, it changed the < and > for < and > and that change caused the problem.

When I did add the tags and saved the template while still in "CODE" mode, it worked :D

Thanks @danielweinmann!

That issue regarding the switch between "CODE" and "DESIGN" is a high priority fix.

o/

Ha, had to look that one up (highest of fives to you sir)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thinkingserious picture thinkingserious  路  3Comments

maelfosso picture maelfosso  路  4Comments

MadReal picture MadReal  路  4Comments

hugomallinson picture hugomallinson  路  3Comments

thinkingserious picture thinkingserious  路  5Comments