daniel-zahariev / php-aws-ses

PHP classes that interfaces Amazon Simple Email Service
307 stars 100 forks source link

How to use the library to send bulk emails? #87

Open DevKishan opened 3 years ago

DevKishan commented 3 years ago

I need to send bulk emails to multiple recipients using Amazon SES. Also, each email should be personalized according to the recipient's data. e.g. In the email content and the subject, {{Name}} placeholder tag should be replaced with provided recipient data for each recipient.

Is it possible with this library?

daniel-zahariev commented 3 years ago

You'll need to send every single personalised email with this library

DevKishan commented 3 years ago

Thanks for your prompt response. Is there any custom code available that can be added to the library to use it for bulk sending?

daniel-zahariev commented 3 years ago

The library's main purpose is to send emails and in the latest versions the bulk sending mode is enabled by default. What more do you need?

DevKishan commented 3 years ago

Currently, I need to send personalized emails in batches

i.e. if there are 5000 emails that have to be sent, then break them into 5 batches each containing 1000 emails.

Prepare some personalization data(name, age, etc) for each email recipient in a batch and then send all emails in the batch along with personalization data of recipients to Amazon SES API in one API request only. This would repeat for each batch then until all batches are processed.

Will that be possible with the library?

daniel-zahariev commented 3 years ago

You're looking in the wrong place. As far as I know this is not possible with Amazon SES. With SES you'll have to send the email body (text/html) to the API for every single recipient. No way to use a template and send parameters for every recipient.

rambhosale commented 3 years ago

@daniel-zahariev I think @DevKishan is looking for this API sendBulkTemplatedEmail https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-email-2010-12-01.html#sendbulktemplatedemail

tobwen commented 2 years ago

See also: https://docs.aws.amazon.com/ses/latest/dg/send-personalized-email-api.html