Reputation: 3068
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.
Upvotes: 9
Views: 1121
Reputation: 1086
I was running in to the 10000 bytes limit as well. In my case it was an edge case so for these calls I added a fallback using regular SMTP sending.
Not an option for everybody but it was very easy to get in place.
Upvotes: 0
Reputation: 2617
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!
Upvotes: 1