DEV Community

Serguey Shinder
Serguey Shinder

Posted on

Our Invoice Run Sent Ten Thousand Emails From the Credit Control Mailbox and Microsoft Stopped It Sending Anything

Every night a script emails the day's invoices to our trade customers, and at month end it also sends each account a statement. Until last year it sent them through an old mail server in our building. When we retired that server, the script was changed to send through the credit control team's mailbox in Microsoft 365, so customers who replied would reach a person.

It worked for nine months. A normal night is about three and a half thousand emails. In September we also started emailing proof of delivery copies, which roughly doubled that.

On the last working day of October the run included a day of invoices, a day of delivery copies and eleven thousand statements. Exchange Online limits each mailbox to ten thousand recipients in any twenty four hours. Partway through the statements, the mailbox reached the limit and Microsoft stopped it sending anything at all.

The script logged each failure and carried on, as designed, so the run finished with a report nobody read until morning. By then the credit controllers had arrived to chase month end payments and could not send a single email from the mailbox they worked in. Their replies bounced with a message about a daily limit. For most of the busiest collection day of the month, the team could ring customers but not write to them, and about two thousand statements had not gone out.

The limit is documented, and it is generous for a person. It was never meant for a program sending thousands of documents a night, and nobody had asked whether the script's volume would grow when other teams added things to it.

Invoices, statements and delivery copies now go through a service built for sending bulk transactional email, from their own address, with our domain's authentication set up for it. Replies still reach credit control, because the reply address is theirs. The run raises an alert if more than a handful of emails fail, instead of only writing them down. And every scheduled job that sends email now records its average volume, reviewed when anyone adds to it.

Automation borrowed a person's mailbox and then outgrew what a person sends. When a job runs on a service designed for people, find its limits before the job does.

– Serguey Shinder

Top comments (0)