sklarsa / django-sendgrid-v5

An implementation of Django's EmailBackend compatible with sendgrid-python v5+
MIT License
318 stars 54 forks source link

AttributeError: 'Mail' object has no attribute 'set_template_id' #107

Closed bmull closed 1 year ago

bmull commented 2 years ago

I'm following instructions from the README, using Django 3.1.6, Python 3.7.7, django-sendgrid-v5==0.6.8 and tried to send an email with a template ID. I get the error AttributeError: 'Mail' object has no attribute 'set_template_id'

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/.../venv/lib/python3.7/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/.../venv/lib/python3.7/site-packages/sendgrid_backend/mail.py", line 52, in send_messages
    data = self._build_sg_mail(msg)
  File "/.../venv/lib/python3.7/site-packages/sendgrid_backend/mail.py", line 93, in _build_sg_mail
    mail.set_template_id(msg.template_id)
AttributeError: 'Mail' object has no attribute 'set_template_id'
sklarsa commented 2 years ago

I recommend upgrading to a more recent version of django-sendgrid-v5 to ensure compatibility with more recent django apis

On Mar 2, 2022, at 1:13 AM, Brenden Mulligan @.***> wrote:

 I'm following instructions from the README, using Django 3.1.6, Python 3.7.7, django-sendgrid-v5==0.6.8 and tried to send an email with a template ID. I get the error AttributeError: 'Mail' object has no attribute 'set_template_id'

Traceback (most recent call last): File "", line 1, in File "/.../venv/lib/python3.7/site-packages/django/core/mail/message.py", line 284, in send return self.get_connection(fail_silently).send_messages([self]) File "/.../venv/lib/python3.7/site-packages/sendgrid_backend/mail.py", line 52, in send_messages data = self._build_sg_mail(msg) File "/.../venv/lib/python3.7/site-packages/sendgrid_backend/mail.py", line 93, in _build_sg_mail mail.set_template_id(msg.template_id) AttributeError: 'Mail' object has no attribute 'set_template_id' — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.