Sendgrid-php: Batch sending template with substitution

Created on 22 Feb 2017  路  5Comments  路  Source: sendgrid/sendgrid-php

Issue Summary

When using personalizations to send a batch of emails, using template and substitutions with different content but same subject, to the same Gmail account, all emails are flagged as delived on SendGrid but only one is really delivered on Gmail.

Steps to Reproduce

  1. Create a SendGrid template that receive the subject and content as substitutions
  2. Create 2 personalizations:
    2.1. To the same Gmail account
    2.2. With same subject
    2.3. Different content
  3. Send it
Example situation (Why do you consider this to be a bug?):
  • Using a single template as default to all application emails.
  • A user can be admin of many teams
  • Teams receive one daily alert email
  • Team information needs to be confidential, therefore each alert needs to be sent as individual email (case the user needs to forward the email to someone).

In this case, if the emails can't be delayed (eg: admin chooses the hour to receive), by breaking them in many batches, and the subject can be the same (eg: filled by the admin) this issue can generate some headache. (not my real case)

Possible solutions (What do you expect to happen instead?):
  • Option 1: Send the batch correctly:

    • by creating a new SMTP-ID to all duplicated emails (no matter the subject)

    • or talk to Gmail team to find a better solution

  • Option 2: Don't accept the batch and display an error:

    • Update this information on docs

    • Error examples:

    • Personalizations can not have duplicate emails with the same subject

    • Personalizations can not have duplicate emails

Technical details:

help wanted question

Most helpful comment

@peluprvi THANK YOU for trying this out, I really really appreciate it. We will make the note. This is great.

All 5 comments

This is an odd question, but would it be possible to test this with a system that is not Gmail based? Our current assumption on this, because we are seeing the emails leave our infrastructure, is that gmail is "eating" those emails due to the SMTPID being the same.

The SMTP-ID is generated at request time, to tell the recipient "This email was sent by the same request to the SMTP server". We believe that since the emails are all requested to be sent at the same time, by the same requester, with the same SMTP-ID - gmail is assuming they are all the same.

We would love to be incorrect here, but this has been our experience.

Edit: added last sentence.

Testing a single call to Gmail, Hotmail and Yahoo (same SMTP-ID for all 6 expected emails), I got these results:

  • Gmail:

    • 1 email received

    • 2 emails flagged as delived on SendGrid, different reason messages

  • Hotmail:

    • 1 email received

    • 2 emails flagged as delived on SendGrid, same reason messages

  • Yahoo:

    • 2 emails received

    • 2 emails flagged as delived on SendGrid, same reason messages

@mbernier, I think you are right about they are assuming that the emails are all the same or maybe it's for some security reason. It's not a default behavior, because Yahoo has a different approach than Gmail and Hotmail.

I think it's better include this validation (email + subject) on SendGrid's docs and internal proccess, informing about it and the batch wiil need to be divided before send it to SendGrid.

@peluprvi THANK YOU for trying this out, I really really appreciate it. We will make the note. This is great.

@peluprvi,

Thank you for being awesome :)

We would like to offer you some swag as a small thank you. Could you please fill out this form for us?

With Best Regards,

Elmer

Is this going to get fixed ever? This issue makes it practically impossible to send multiple emails to the same email address in a single API request.

Or is there some other way to send multiple emails in one request whereby each email will have its own SMTP-ID?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atsareva picture atsareva  路  4Comments

rsalunga29 picture rsalunga29  路  4Comments

KayakinKoder picture KayakinKoder  路  5Comments

buddyy93 picture buddyy93  路  5Comments

Aubynj picture Aubynj  路  3Comments