Select Language:
If you’re using AWS SES over SMTP for your self-hosted newsletter system and suddenly start seeing errors, you’re not alone. Here’s a simple way to understand and fix the issue.
First, it’s important to note that your current email quota is 50,000 emails every 24 hours, with a maximum of 14 emails per second. Since you usually send about 1,000 emails daily spread throughout the day, this setup should normally work fine.
However, if you start getting an error like “Expected response code 250 but got code ‘421’, with message ‘421 Connection closed by server. Maximum message count per session reached,’” it suggests there’s a problem with the connection to AWS SES. This specific error indicates that you’ve hit a limit on the number of emails or messages that can be sent in one session.
So, what’s causing this? One possibility is that your email sending session is reaching AWS SES limits. AWS SES sessions sometimes terminate if too many messages are sent in a single connection, which might cause your sending process to stop working after some emails.
Additionally, you received an email from Amazon saying your usage has exceeded 85% of the Free Tier limit for some services. For example, with SES, your counts show 2,740 emails out of a 3,000 limit. Usually, when the Free Tier is exceeded with other AWS services, billing starts. But with SES, the main effect is that your account is close to or at the limit, which could restrict your email sending.
However, since SES is billed on a pay-as-you-go basis, reaching these limits shouldn’t necessarily stop your service unless you’ve also gone past your set quotas. In your case, your dashboard indicates a 50,000 email per day ceiling, so the free tier limitations are unlikely to be the root cause.
How to fix this?
One straightforward solution is to reset your connection or session with SES after sending a certain number of emails. For example, instead of sending multiple emails in one session, break your sending process into smaller batches, creating a new session each time. This way, you avoid hitting the maximum message count per session and prevent connection closures.
Also, keep track of your email counts and ensure you’re not exceeding SES limits, which could lead to temporary restrictions. If your volume increases, consider requesting a quota increase through the AWS console.
In summary:
– Break your email sending into smaller batches to prevent hitting session limits.
– Monitor your SES usage to stay within your quotas.
– Be aware of the account notifications regarding usage limits; sometimes, these indicate where you might need to adjust your sending process or request higher limits.
Implement these steps, and you should see fewer errors and a smoother email sending experience.