Closed MattFanto closed 3 years ago
Why a warning and not an error? I'm always a fan of clearer logging, and this seems like something that's easy to check. We know we're going to raise a 400 when we try to deliver the email so why not just raise an error first?
You throwing an error? Well I think that in that case the error from SendGrid would more self-explanatory and easier to maintain. If you mean instead logger.error sure probably more appropriate, but still not sure if this pre-check is really useful
Thanks for your contribution! I'm making a release now
While using this library I faced an issue with Sendgrid I had some duplicates across to, cc and bcc.
E.g. to = ["test@test.com"] cc = ["test@test.com"] bcc = ["test@test.com"]
Unfortunately, the printed log is a non-helpful "HTTP 400 Bad request" which made debugging really difficult while the response body from Sendgrid was really helpful to understand the issue
Compare to sendgrid django doesn't raise an issue for this kind of scenario, if it could be helpful I can add as part of this PR few lines of code to remove duplicates across bcc cc and to, e.g.:
But I'm not sure if this is can be helpful