Skip to content

Duplicate emails in the Personalization object are not allowed, make this obvious #788

Closed

Description

@tomwwagstaff-product

Issue Summary

When you add a recipient email address again as a BCC address, sending fails with:

BadRequestsError: HTTP Error 400: Bad Request

Steps to Reproduce

  1. Add the same email address as a recipient and BCC.

Technical details:

sendgrid Version: 5.4.1
Python Version: 3.6

See this issue: #779

Activity

  1. thinkingserious commented on Apr 24, 2019

    @thinkingserious
    Contributor

    Thanks for taking the time to post this issue @tomwwagstaff-product!

    It is expected behavior for the Twilio SendGrid API to reject emails that have duplicate emails within the Personalization object.

    We should provide a meaningful error when someone attempts to add duplicate emails.

  2. changed the title [-]Bug: can't BCC an email recipient[/-] [+]Duplicate emails in the Personalization object are not allowed, make this obvious[/+] on Apr 24, 2019
  3. DougCal commented on Jul 6, 2020

    @DougCal
    Contributor

    Going to look into this one

  4. childish-sambino commented on Jul 6, 2020

    @childish-sambino
    Contributor

    Note that in C# we now de-dupe the recipients rather than error: sendgrid/sendgrid-csharp#991

  5. DougCal commented on Jul 10, 2020

    @DougCal
    Contributor

    So I think I have a solution for this right now. Do we want to de-dupe on a Mail object's construction, or do we want to de-dup emails whenever possible on the Personalization object, including on setters? Currently, I'm doing it on a Mail object's construction (more specifically, in Personalization.add_email), and whenever Personalization.add_to, Personalization.add_bcc, or Personalization.add_cc are called. Essentially, I just check if the email already exists somewhere in _tos, _bccs or _ccs, and if so, we don't add the email.

  6. childish-sambino commented on Jul 10, 2020

    @childish-sambino
    Contributor

    I think de-dupe whenever possible, but not de-dupe across to/cc/bcc; dupes are allowed between them.

  7. kamaldua65 commented on Mar 17, 2021

    @kamaldua65

    I am sending login details to users with personalization in bulk (say 500 users at one time). in my application 2 users can have same email.
    When I send emails , if 2 users have same email, only one is delivered.
    Is there a setting to ignore duplicate emails, as with personalization contents may be different.

  8. mohankr123 commented on Feb 18, 2022

    @mohankr123

    I am sending login details to users with personalization in bulk (say 500 users at one time). in my application 2 users can have same email. When I send emails , if 2 users have same email, only one is delivered. Is there a setting to ignore duplicate emails, as with personalization contents may be different.

    Same issue. Did you get any solution?

  9. childish-sambino commented on Feb 18, 2022

    @childish-sambino
    Contributor

    Thanks for submitting a GitHub issue! We are very sorry that you are running into this problem. In order to better serve you, as this does not present itself as a library specific issue, we would like to ask that you reach out to our support team at support.sendgrid.com.

  10. locked as resolved and limited conversation to collaborators on Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions