{"action":"created","issue":{"url":"https://api.github.com/repos/elbuo8/sendgrid-django/issues/21","repository_url":"https://api.github.com/repos/elbuo8/sendgrid-django","labels_url":"https://api.github.com/repos/elbuo8/sendgrid-django/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/elbuo8/sendgrid-django/issues/21/comments","events_url":"https://api.github.com/repos/elbuo8/sendgrid-django/issues/21/events","html_url":"https://github.com/elbuo8/sendgrid-django/pull/21","id":159335374,"number":21,"title":"Add SendGrid Template substitutions to SMTP API Header","user":{"login":"se1exin","id":2385350,"avatar_url":"https://avatars.githubusercontent.com/u/2385350?v=3","gravatar_id":"","url":"https://api.github.com/users/se1exin","html_url":"https://github.com/se1exin","followers_url":"https://api.github.com/users/se1exin/followers","following_url":"https://api.github.com/users/se1exin/following{/other_user}","gists_url":"https://api.github.com/users/se1exin/gists{/gist_id}","starred_url":"https://api.github.com/users/se1exin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/se1exin/subscriptions","organizations_url":"https://api.github.com/users/se1exin/orgs","repos_url":"https://api.github.com/users/se1exin/repos","events_url":"https://api.github.com/users/se1exin/events{/privacy}","received_events_url":"https://api.github.com/users/se1exin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-09T06:14:09Z","updated_at":"2016-07-25T14:19:10Z","closed_at":"2016-07-25T14:19:10Z","pull_request":{"url":"https://api.github.com/repos/elbuo8/sendgrid-django/pulls/21","html_url":"https://github.com/elbuo8/sendgrid-django/pull/21","diff_url":"https://github.com/elbuo8/sendgrid-django/pull/21.diff","patch_url":"https://github.com/elbuo8/sendgrid-django/pull/21.patch"},"body":"As per https://sendgrid.com/docs/API_Reference/Web_API_v3/Transactional_Templates/smtpapi.html, the SMTP API allows the use of template substitutions.\r\n\r\nExample usage:\r\n```\r\n    from django.core.mail import EmailMultiAlternatives\r\n    subject = \"My cool subject\"\r\n    from_email = \"sender@email.com\"\r\n    to_email = \"receiver@email.com\"\r\n\r\n    mail = EmailMultiAlternatives(\r\n        subject=subject,\r\n        from_email=from_email,\r\n        to=[to_email],\r\n        body=\"\",\r\n        headers={\r\n            \"Reply-To\": from_email,\r\n            \"sub\": {\r\n                \":sendername\": [  # ':sendername' is a custom template replacement defined in SendGrid\r\n                    \"John Doe\"  # Number of array entries == number of recipients in the EmailMultiAlternatives 'to' param\r\n                ],\r\n            },\r\n            \"Filters\": {\r\n                \"templates\": {\r\n                    \"settings\": {\r\n                        \"enable\": 1,\r\n                        \"template_id\": \"xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx\"\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    )\r\n    mail.attach_alternative(\"some text that will get replaced anyway\", \"text/html\")\r\n    mail.send()\r\n```"},"comment":{"url":"https://api.github.com/repos/elbuo8/sendgrid-django/issues/comments/234966425","html_url":"https://github.com/elbuo8/sendgrid-django/pull/21#issuecomment-234966425","issue_url":"https://api.github.com/repos/elbuo8/sendgrid-django/issues/21","id":234966425,"user":{"login":"elbuo8","id":1168554,"avatar_url":"https://avatars.githubusercontent.com/u/1168554?v=3","gravatar_id":"","url":"https://api.github.com/users/elbuo8","html_url":"https://github.com/elbuo8","followers_url":"https://api.github.com/users/elbuo8/followers","following_url":"https://api.github.com/users/elbuo8/following{/other_user}","gists_url":"https://api.github.com/users/elbuo8/gists{/gist_id}","starred_url":"https://api.github.com/users/elbuo8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elbuo8/subscriptions","organizations_url":"https://api.github.com/users/elbuo8/orgs","repos_url":"https://api.github.com/users/elbuo8/repos","events_url":"https://api.github.com/users/elbuo8/events{/privacy}","received_events_url":"https://api.github.com/users/elbuo8/received_events","type":"User","site_admin":false},"created_at":"2016-07-25T14:19:10Z","updated_at":"2016-07-25T14:19:10Z","body":"Added #19 "}}
{"actor":{"display_login":"elbuo8"}}