Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sendgrid: Send distinct mails to different recipients in one request

Tags:

c#

email

sendgrid

Tried using personalization with substitution like %body%. However, I get an error saying Substitutions are limited to 10000 bytes per personalization. Basically the whole body would differ recipient to recipient.

Is there another efficient way to send distinct mails to different recipients?

Sending one mail per request would be very slow.

PLEASE NOTE: Template isn't an option as the mails are created based on user's current activity.

like image 406
Shyamal Parikh Avatar asked Jun 29 '16 22:06

Shyamal Parikh


People also ask

How do I send an email to multiple recipients in SendGrid?

The most straightforward way to send bulk emails is to have an array of addresses in the to field, and then call sendMultiple with a single message object. Copy this code into index. js and replace the emails in the to array with your email addresses. const sgMail = require('@sendgrid/mail'); sgMail.

Can you BCC in SendGrid?

For example, you can define when you would like it to be sent, what headers you would like to include, and any substitutions or custom arguments you would like to be included with the email. Personalizations allow you to define: "to", "cc", "bcc" - The recipients of your email.

How many emails can you send at once with SendGrid?

Once you create a sender identity a, you can send 100 emails per day. If you need to send more than that, complete your account setup to upgrade to a paid plan!

What is unique opens in SendGrid?

The “Unique opens” percentage is the number of unique individuals that have opened your emails, divided by the total number of Delivered messages. SendGrid will store tracking data for unique open events for up to 7 days.


1 Answers

I think that what you are asking is simply not possible under Sendgrid's API. They are already providing you with an option to include variables (10000 bytes) to do so.

Proposal #1: You could use a Queue (ApacheMQ or Amazon SQS) system with a few workers to process the sending of emails. The queue is to prevent any email of not being delivered, and the workers are for letting you send more than one email at a time (2 workers, 2 emails being sent in parallel).

Proposal #2: Have a simple cronjob that runs every 5 minutes (you will need to calculate that according to how many emails you have to send and which is the acceptable delay under which to send the emails) and gets 100 customers to who to send emails, based on a column of a database that tells you whether you have sent the email or not, so you avoid sending more than one email to the same customer.

Ideally, I will stick with the 1st proposal, but it could require more work. You could start with #2 and then work on #1 bit by bit.

Hope it helps!

like image 82
xarlymg89 Avatar answered Oct 12 '22 22:10

xarlymg89