-
Notifications
You must be signed in to change notification settings - Fork 78
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
Issues When attaching file with email in sendgrid v3 APIs #60
Comments
@jayhale Below is the code which I am using to send an email : from django.core.mail import EmailMultiAlternatives
class EmailNotification(BaseNotification):
"""
Notification class for Email notification
"""
def __init__(self, destination, message, case, content_object, subject, message_html, attachment_name=None, attachment_type=None, attachment=None):
super().__init__(destination, message, case, content_object)
self.attachment = attachment
self.attachment_name = attachment_name
self.attachment_type = attachment_type
self.subject = subject
self.message_html = message_html
self.email_message = EmailMultiAlternatives(self.subject, self.message, 'DJ<[email protected]>',
[self.destination])
if self.attachment:
self.email_message.attach_file(self.attachment)
if self.message_html:
self.email_message.attach_alternative(x
self.message_html, 'text/html')
def send(self):
"""Send email to destination
"""
return self.email_message.send() |
@jayhale Today Again I got the same error (this email do not have any attachment with it).
Error tracback :
|
Yes I see - I'm thinking the fix is for the package to raise an error when the content is EDIT: The issue isn't with the package, it's handling the zero-length content as expected and the API is rejecting it. |
@jayhale But Howcome earlier the same code was working and even if package raise an error then what content one must send and where (in which variable)? |
Your I don't know if anything changed in the API. This package has used the v3 API for the past year: Check that the length of your message is greater than zero - I think the issue is there. |
Yes, issue id fixed. Anyway Thanks a lot. |
I was using this package for sending email with sendgrid. Everything was working fine but some days ago one of my email where I attach an excel sheet started raising errors.
On debugging I find out that it was because of new Behaviour of sendgrid V3 APIs.
The issue I was getting is
bad Request error
. Complete error is as follows :Seems kile sendgrid don't accept
content=None
anymore.In sendgrid package file named
mail.py
classMail()
they acceptcontent
kwargs but this package doesn't seems to sendcontent
when usingMail()
insgbackend/mail.py _build_sg_mail()
.You can also find out the same issue raised here
The text was updated successfully, but these errors were encountered: