-
Notifications
You must be signed in to change notification settings - Fork 714
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
Bcc, cc and multiple to fields in Personalization don't work #738
Comments
Hi @thinkingserious , Here is a simple script which reproduces the error
If you replace the SENDGRID_API_KEY string value with your API Key, the script can be run as-is without any modification to reproduce the error. Only dependency is Python 3.7.0 and sendgrid-python 5.6.0. After running the script, I can see the below error message -
As per the error message, the |
Hi @thinkingserious is there any update on this? |
Hi there, I have the same issue as above: once BCC field is set, the mail.send.post returns with:
Could you please elevate this "question" to an actual bug priority? Thanks! |
OK, the curl example from @thinkingserious original link
gives one hint:
/CC @swapnilt |
@cipy although your curl example is giving hint regarding duplicate email ids, as I've confirmed above even providing different email addresses gives me the same error. |
Looking at your script that produces the issue it looks like you added the TO address outside of the personalization block. This looks like it resulted in two personalization blocks. One with a TO and one with a BCC. To get things working you need the personalization block to have the TO and BCC in one personalization block. I think what you are looking for is something like this:
Your issue looks different from the first, but to be sure we would likely need to see your code to get a better idea of what is happening. We also might be able to get this figured out using the JSON in your cURL call if you can provide that. |
@kylearoberts I've taken a lot of time to verify this issue and explain it in as much detail as possible. Request you to please go through everything I've posted. Please see the output yourself by running the script I've posted. Kindly verify that the suggestion which you've given actually works by making those modifications in the script. I've posted the output of the script too and you can clearly see that there is only a single personalization block in the request. If you just try it yourself, you'll see that making the changes which you suggested don't work. If this was just a sendgrid-python library issue, I'd have been happy to submit a PR myself but this looks like server side issue. So the actual issue is THERE IS NO WAY TO SEND CC/BCC MAILS WITH V3 API. Atleast for me. I urge you to try sending one yourself using curl, python, whatever. That sounds like a pretty major issue to me and I hope the team takes it seriously. |
Sorry for not being clearer in my response. I do want to say that you did a great job of explaining and provided some great information. I have two examples for you below, one is a modification of your code and the other is an example I created. These examples have been tested and shown to be working as expected. Your code modified:
My code example:
To improve our libraries we would love to have your feedback on the helpers here. This is not the only case we have run into where there has been confusion about how to structure things like this and we would like to get feedback to help with improvements that we will make. If this does not solve your issue please let us know and we will try our best to meet your needs. |
@kylearoberts Thank you so much for giving the right solution. I can confirm that my examples are now working. |
Hi Swapnilt I have the same problem, can you help me out as how I can get the above error details. Thanks a lot. |
@shopiex Its actually very simple and annoying. In my case, I wasn't adding the
The other way to create Mail object is what kyle has shown -
|
Hi All, |
Issue Summary
I'm using sendgrid-python version 5.6.0. I'm able to send emails as long as there are only the following fields in the email
Apart from this any extra field if added to personalization object, I get a HTTP 400 BadRequest. Moreover, the response body is empty so there is no specific error message. I'm using mail helper function but you can clearly see the data structure which get posted in the final call. See below examples which I've tried out. Actual email ids have been masked out.
bcc field doesn't work
Note that although the subject field is repeated above in mail object as well as personalization object, I've tried having it only in mail object and only in personalization object as well. It doesn't matter. It's a bit weird that subject can get added to two places in the object even while using helper functions which is not the case with
to
field. Irrespective of whether you addto
field usingMail
object constructor or viaPersonalization.subject
, it always correctly adds it under personalization field in the resulting object. That is not the case withsubject
.cc
does not workmultiple
to
fields also do not workIn some cases above the
from
email id is also added ascc
orbcc
since I have that requirement. But I've also tried adding some other email id there and it doesn't matter. In all the above cases the response body is empty.In all the above cases if I remove the the additional
cc
orbcc
orto
field from the personalization, I'm able to successfully send the email.Technical details:
The text was updated successfully, but these errors were encountered: