Reputation: 2885
As so far, I've been sending emails to multiple recipients by Sakura Japan SMTP server in my LoopBack
app.
{
"emailDs": {
"name": "emailDs",
"connector": "mail",
"transports": [{
"type": "smtp",
"host": "myapp.sakura.ne.jp",
"secure": false,
"port": 587,
"tls": {
"rejectUnauthorized": false
},
"auth": {
"user": "~ ~ ~.sakura.ne.jp",
"pass": "~ ~ ~"
}
}]
}
}
It's almost working properly unless the number of recipients is much less than 100. But it won't work when the number quite over 100 - e.g. 150.
Thus, I'm going to migrate AWS SES
but I wonder if there would be any restriction with the number of recipients just due to the following quotation:
The message cannot include more than 50 recipients, across the To:, CC: and BCC: fields. If you need to send an email message to a larger audience, you can divide your recipient list into groups of 50 or fewer, and then call the sendEmail method several times to send the message to each group.
So, please anybody tells me whether there's a limit with the number of recipients or not if you've experienced in.
Thanks in advance.
PS: Here the sample code of AWS SES
goes:
// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');
// Set the region
AWS.config.update({region: 'REGION'});
// Create sendBulkTemplatedEmail params
var params = {
Destinations: [ /* required */
{
Destination: { /* required */
CcAddresses: [
'EMAIL_ADDRESS',
/* more items */
],
ToAddresses: [
'EMAIL_ADDRESS',
'EMAIL_ADDRESS'
/* more items */
]
},
ReplacementTemplateData: '{ \"REPLACEMENT_TAG_NAME\":\"REPLACEMENT_VALUE\" }'
},
],
Source: 'EMAIL_ADDRESS', /* required */
Template: 'TEMPLATE_NAME', /* required */
DefaultTemplateData: '{ \"REPLACEMENT_TAG_NAME\":\"REPLACEMENT_VALUE\" }',
ReplyToAddresses: [
'EMAIL_ADDRESS'
]
};
// Create the promise and SES service object
var sendPromise = new AWS.SES({apiVersion: '2010-12-01'}).sendBulkTemplatedEmail(params).promise();
// Handle promise's fulfilled/rejected states
sendPromise.then(
function(data) {
console.log(data);
}).catch(
function(err) {
console.log(err, err.stack);
});
Upvotes: 2
Views: 3600
Reputation: 2885
According to the AWS SES
documentation, I've thought that I could send bulk mails without any limitation by using sendBulkTemplatedEmail()
function of AWS JS SDK.
Create an object to pass the parameter values that define the email to be sent, including sender and receiver addresses, subject, email body in plain text and HTML formats, to the sendBulkTemplatedEmail method of the AWS.SES client class. To call the sendBulkTemplatedEmail method, create a promise for invoking an Amazon SES service object, passing the parameters. Then handle the response in the promise callback.
However, the following 2 links explain me the different workaround for the production lifecycle since there's an even technical restriction of 50 recipients.
AWS SES SendBulkTemplatedEmail, example and what happens if quota is exceeded?
Managing Your Amazon SES Sending Limits
So, AWS SES
recommends that I'd call sendEmail()
once for every recipient.
Sending limits are based on recipients rather than on messages. For example, an email that has 10 recipients counts as 10 against your quota. However, we do not recommend that you send an email to multiple recipients in one call to SendEmail because if the call to Amazon SES fails (for example, the request is improperly formatted), the entire email will be rejected and none of the recipients will get the intended email. We recommend that you call SendEmail once for every recipient.
To make a long story short,
sendBulkTemplatedEmail()
Thanks for attention.
Upvotes: 2