1

I'm currently seeing a bunch of the same errors in our mail.log in ColdFusion 11:

com.sun.mail.smtp.SMTPSendFailedException: 454 Throttling failure: Maximum sending rate exceeded.

There's 200 or so at the exact same datetime, and then another batch of 200 or so at another random time (presumably a different email several hours later).

We're using Amazon SES, and the max send rate on our account is "14 emails/second." Based on those errors we're seeing in mail.log, we assume this rate is being exceeded by ColdFusion trying to send too many at once. Does that assumption sound correct?

Looking around the CF 11 Admin, I'm unsure about what adjustments we need to make to ensure CF doesn't exceed the 14/s rate. Here are some of our current settings (under CF Admin > Server Settings > Mail) which may or may not apply:

[x] Maintain connection to mail server Connection Timeout (in seconds): 60 [ ] Enable SSL socket connections to mail server [x] Enable TLS connection to mail server

Spool Interval (in seconds): 15 Mail Delivery Threads: 10 [x] Spool mail messages for delivery to: Disk Maximum number of messages spooled to memory: 50000

Michael
  • 2,546
  • 2
  • 20
  • 26
  • 1
    Ps. You can request and increased sending rate by applying to aws, might be worth trying before messing around with the settings more. – jontro Nov 15 '17 at 16:07
  • Thanks, that's good to know. We're currently under probation for our SES complaint rate (we're working on correcting that - absolutely unintentional), so I'm not sure how that would go right now, heh. I may request the higher sending rate after we get the complaints sorted out. – Michael Nov 15 '17 at 16:11
  • Anyways it's hard to find documentation of the how the mail delivery threads work. I'm not sure they will only send one mail, maybe instead process the full queue. The Spool interval just defines how often the directory is set. – jontro Nov 15 '17 at 16:16
  • According to everything I'm finding so far, it looks like I'm going to have to build my own batch processor before it gets to the cfmailer. That is, if the sending amount exceeds SES limits, save the list of emails to a database. Then, set a scheduled task to run through the list of emails every so often and cfmail each batch individually until the task is scheduled to run again. – Michael Nov 15 '17 at 18:41
  • @jontro - I think each thread tries to send as much of the queue as it can, up to some batch size based on total items waiting. So the more threads, the more messages potentially sent at one time. – SOS Nov 17 '17 at 22:21

1 Answers1

2

When messages transport is rejected by the SMTP server, the ACF server will respool those items for future delivery, which will retry at regular intervals. As such, you probably don't need to add additional code to handle them, unless you're dealing with emails in the hundreds or thousands.

If either of the latter are the true, request a rate limit increase from AWS, or look in to another transactional email provider which provides a higher rate ( e.g. - SendGrid ).

Another option is to connect directly to the SES API and and use its multi-send options to bypass eliminate the throttling of individual SMTP requests. If the emails being sent are error reports, I would suggest using a separate bug tracking application like Rollbar or BugLogHQ, to eliminate redundant transactional bug report mail - thus freeing up the throttle for true application transactional messages.

JClausen
  • 321
  • 2
  • 2
  • Thank you. Yes, in the current use case I'm dealing with emails of 500 at a time, but that could potentially start pushing 1,000. These are for forum subscription notifications, not error reports. I will look into the SES API - thank you. – Michael Nov 16 '17 at 15:47
  • We received a rate increase from AWS SES and everything is working great now. I wasn't sure how common it was for people in our position to need that high of a rate, but SES didn't have any problem with it once we got our account in good standing and explained our specific use case clearly. Thanks for your suggestion. – Michael Dec 21 '17 at 16:38