{"action":"created","issue":{"url":"https://api.github.com/repos/anymail/django-anymail/issues/24","repository_url":"https://api.github.com/repos/anymail/django-anymail","labels_url":"https://api.github.com/repos/anymail/django-anymail/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/anymail/django-anymail/issues/24/comments","events_url":"https://api.github.com/repos/anymail/django-anymail/issues/24/events","html_url":"https://github.com/anymail/django-anymail/issues/24","id":162119462,"number":24,"title":"Emails using SparkPost templates arrive empty","user":{"login":"ojwoodford","id":2445548,"avatar_url":"https://avatars.githubusercontent.com/u/2445548?v=3","gravatar_id":"","url":"https://api.github.com/users/ojwoodford","html_url":"https://github.com/ojwoodford","followers_url":"https://api.github.com/users/ojwoodford/followers","following_url":"https://api.github.com/users/ojwoodford/following{/other_user}","gists_url":"https://api.github.com/users/ojwoodford/gists{/gist_id}","starred_url":"https://api.github.com/users/ojwoodford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ojwoodford/subscriptions","organizations_url":"https://api.github.com/users/ojwoodford/orgs","repos_url":"https://api.github.com/users/ojwoodford/repos","events_url":"https://api.github.com/users/ojwoodford/events{/privacy}","received_events_url":"https://api.github.com/users/ojwoodford/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-06-24T10:28:50Z","updated_at":"2016-06-24T18:21:28Z","closed_at":null,"body":"I use two approaches for sending email:\r\n\r\n1. Use django.core.mail.send_mail() and send the email template along with the parameters.\r\n2. Use django.core.mail.EmailMessage() and django.core.mail.get_connection().send_messages() to use an email template in my ESP account.\r\n\r\nI have been using Mandrill up until now, and want to switch to SparkPost. I have configured and published templates in both my Mandrill and SparkPost accounts, and my API keys for both services. The slug for a given template on Mandrill is the same as both the name and ID of the equivalent template on SparkPost. I used SparkPost's migration tool so this should be correct.\r\n\r\nWhen I switch the email backend from anymail.backends.mandrill.MandrillBackend to anymail.backends.sparkpost.SparkPostBackend, the emails sent via send_mail() come through fine, but the emails using the templates, sent via send_messages(), arrive with an empty message body, i.e. there is no email. I can send the templates as test emails with dummy data via the SparkPost dashboard just fine."},"comment":{"url":"https://api.github.com/repos/anymail/django-anymail/issues/comments/228421611","html_url":"https://github.com/anymail/django-anymail/issues/24#issuecomment-228421611","issue_url":"https://api.github.com/repos/anymail/django-anymail/issues/24","id":228421611,"user":{"login":"medmunds","id":639984,"avatar_url":"https://avatars.githubusercontent.com/u/639984?v=3","gravatar_id":"","url":"https://api.github.com/users/medmunds","html_url":"https://github.com/medmunds","followers_url":"https://api.github.com/users/medmunds/followers","following_url":"https://api.github.com/users/medmunds/following{/other_user}","gists_url":"https://api.github.com/users/medmunds/gists{/gist_id}","starred_url":"https://api.github.com/users/medmunds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medmunds/subscriptions","organizations_url":"https://api.github.com/users/medmunds/orgs","repos_url":"https://api.github.com/users/medmunds/repos","events_url":"https://api.github.com/users/medmunds/events{/privacy}","received_events_url":"https://api.github.com/users/medmunds/received_events","type":"User","site_admin":false},"created_at":"2016-06-24T18:21:28Z","updated_at":"2016-06-24T18:21:28Z","body":"OK, there are two problems here:\r\n\r\n1. Anymail has a bug with SparkPost stored templates leading to the 422 response you've listed above. I'm looking into that right now.\r\n\r\n2. Your code is using the old Djrill attribute names. You'll need to update them before switching from Mandrill to another Anymail ESP backend (like SparkPost). Please read through Anymail's docs on [migrating from Djrill](http://anymail.readthedocs.io/en/latest/esps/mandrill/#migrating-from-djrill) and change your code as needed.\r\n\r\nTo assist with migrating from Djrill to Anymail, Anymail issues DeprecationWarnings *when you are using Anymail's Mandrill backend* and use the Djrill names. (The new Anymail backends like SparkPost don't even bother looking for the old Djrill names. It's best to work through the migration docs before switching ESPs.)\r\n\r\nThose warnings should show up in your dev server logs (and Django test output, if you have tests on email sending). If you'd like to change the warnings to errors to make them more visible see [this StackOverflow answer](http://stackoverflow.com/a/16457346/647002).\r\n\r\nOr you can run this `git grep` command at the root of your project to find all instances of old Djrill names that need updating (from [the migration docs](http://anymail.readthedocs.io/en/latest/esps/mandrill/#changes-to-emailmessage-attributes)):\r\n\r\n```shell\r\ngit grep -w \\\r\n  -e 'async' -e 'auto_html' -e 'auto_text' -e 'from_name' -e 'global_merge_vars' \\\r\n  -e 'google_analytics_campaign' -e 'google_analytics_domains' -e 'important' \\\r\n  -e 'inline_css' -e 'ip_pool' -e 'merge_language' -e 'merge_vars' \\\r\n  -e 'preserve_recipients' -e 'recipient_metadata' -e 'return_path_domain' \\\r\n  -e 'signing_domain' -e 'subaccount' -e 'template_content' -e 'template_name' \\\r\n  -e 'tracking_domain' -e 'url_strip_qs' -e 'use_template_from' -e 'use_template_subject' \\\r\n  -e 'view_content_link'\r\n```\r\n"}}
{"actor":{"display_login":"medmunds"}}