Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sendgrid Templates Integration #32

Closed
cesarmarroquin opened this issue Nov 17, 2016 · 1 comment
Closed

Sendgrid Templates Integration #32

cesarmarroquin opened this issue Nov 17, 2016 · 1 comment

Comments

@cesarmarroquin
Copy link

Is it possible to use a template from my sendgrid account with this library? I ask because the example code on the github for this library uses django.core.mail code and im not sure how to pass the template id as recommended in the sendgrid documentation.

@andriisoldatenko
Copy link
Collaborator

andriisoldatenko commented Nov 17, 2016

Hi @cesarmarroquin!

from django.core.mail import EmailMultiAlternatives


mail = EmailMultiAlternatives(
        subject=subject,
        body=body,
        from_email=from_email,
        to=[to_email]
    )
# Here you can assign template_id from Sendgrid
mail.template_id = template
mail.substitutions = subs
if file is not None:
    mail.attachments = [(file_name, file, 'application/pdf')]
mail.attach_alternative('test', "text/html")
mail.send()

If you have any questions, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants