Stay off of blacklists: Limit postfix recipients

I have heard this story it seems over and over again, I also have been the topic of many email horror stories. They usually go like this

“I just setup a new server and within days we were on a corporate email blacklist, I contacted the company in question and asked why are we on your blacklist, why won’t you deliver our email. They shared with me an email log of thousands of emails being sent from my mail server through several legitimate email accounts. I ensured that my server was not an open relay so I asked these users, if they had indeed sent this many emails in one shot without any kind of unsubscribe link in the footer of their email. They had! I was so shocked, now what do I do?”

This is an uncomfortable and very perilous position. You want to allow your users to send email to get their job done however you as a systems administrator need to comply with the “Can Spam Act” passed by the FCC to ensure that email continues to flow. You also have companies out there who will block you for violating this act as a precaution on their part. All the while your users can not be bothered to learn about proper email procedures.

In my experience the only thing you can do at this point is to limit how many emails are allowed to be sent at any given time. If you are using OSX Server for Mail or Postfix for Sendmail then this walkthrough will talk about how to limit email recipients and stay off those dreaded blacklists.

Here are the basics that you should know, the following are all settings that can be added to the /etc/postfix/main.cf file of your postfix setup.

smtpd_recipient_limit (default 1000) parameter controls how many recipients the SMTP server will take per message delivery request. You can’t restrict this to a to/cc/bcc field – it’s for all recipients. For that you’d have to use a regular expression in header_checks to arbitrarily limit the length of each header to something reasonable.

smtpd_recipient_overshoot_limit (default 1000) The number of recipients that a remote SMTP client can send in excess of the hard limit specified with smtpd_recipient_limit, before the Postfix SMTP server increments the per-session error count for each excess recipient.

smtpd_hard_error_limit (default 20) parameter to know at what number of errors it will disconnect.

So you technically need to consider the 3 values here which affect both inbound & outbound mail. Then there’s the throttling tools.

smtpd_client_recipient_rate_limit (default: 0 no limit) The maximum number of recipient addresses that an SMTP client may specify in the time interval specified via anvil_rate_time_unit (default: 60s -careful adjusting this affects other things)” and note that this is “regardless of whether or not Postfix actually accepts those recipients” Those over will receive a 450 4.7.1 Error: too many recipients from [the.client.ip.address] It’s up to the client to deliver those recipients at some later time.

smtpd_client_connection_rate_limit (default: 0) The maximal number of connection attempts any client is allowed to make to this service per time unit. The time unit is specified with the anvil_rate_time_unit configuration parameter.

smtpd_client_message_rate_limit (default: 0) The maximal number of message delivery requests that any client is allowed to make to this service per time unit, regardless of whether or not Postfix actually accepts those messages. The time unit is specified with the anvil_rate_time_unit configuration parameter.

The purpose of these features are to limit abuse, as opposed to regulating legitimate mail traffic, but I use them that way in order to mitigate spam blacklisting. In my organization we limit the recipients from one email to 25 you can see the code from my sample /etc/postfix/main.cf. If your file does not have these values you can add them to the bottom of the file.

smtpd_recipient_limit = 50
smtpd_recipient_overshoot_limit = 51
smtpd_hard_error_limit = 20
smtpd_client_recipient_rate_limit = 50
smtpd_client_connection_rate_limit = 10
smtpd_client_message_rate_limit = 25
default_extra_recipient_limit = 50
duplicate_filter_limit = 50
default_destination_recipient_limit = 50
smtp_destination_recipient_limit = $default_destination_recipient_limit

Once done you need to restart postfix

sudo postfix reload

I hope that you all found this article and walkthrough educational, as always please feel free to interact with me by posting questions and comments and I will answer them as best as I can. If you feel like any of this is wrong or could be improved upon also please leave a comment below, thanks!

AI Usage Transparency Report

Pre-AI Era · Written before widespread use of generative AI tools

AI Signal Composition

Rep Tone Struct List Instr
Repetition: 65%
Tone: 52%
Structure: 59%
List: 14%
Instructional: 17%
Emoji: 0%

Score: 0.06 · Low AI Influence

Summary

This article provides a walkthrough on how to limit email recipients and prevent spam blacklisting using Postfix configuration parameters.

Related Posts

Better Quota notifications for OSX Server

OSX Server comes pre-packaged with Dovecot one of the best IMAP services out there and one of the most extensible and flexible in my opinion. That is its flexible and extensible as long as you know how to configure Dovecot which most OSX Server Administrators are not. I had a conversation with a co-worker not too long ago about being an OSX Server Administrator, and I joked that Apple made great hardware and a great OS, but most if not all of the services under the hood for Web, Mail,...

Read more

10.6.8 Server high CPU usage, hwmond culprit

It seems no matter how careful Apple is each OS update (especially server updates) reveals its own challenges for the user, that leaves them wishing that they had not left their stable platform for the bug fixes that made that update so desirable. The 10.6.8 server update was no different; it claimed to fix such long-time bugs as Server Side Rules, which has been a thorn in the side of OS X Server Administrators everywhere who use OS X Servers as their primary email server. So many of us, including...

Read more

OSX Server Mailman Tricks

We have been using XServes as our primary mail servers at my organization for about two years now; we upgraded from an older Linux system and we could not be happier, since moving over to the 10.6 platform, we have enjoyed almost no email downtime, very easy to manage mail system and of course all the goodies that you would expect to run, some of which I have already mentioned (Squirrelmail) and also Mailman. Through my time configuring the server, migrating data and through other requests I have compiled a...

Read more

10.6.2 Mail Server draws a blank, subject?

So we upgraded from 10.5.8 Mail server to 10.6.2 and everything went very smoothly. Mailstores were migrated and the transition from Cyrus to Dovecot was great. However once all the email was moved over and all the settings were double, and triple checked. People started complaining that every once in a while their email was not getting through the server, it was getting bounced back to the sender. At first I thought that it was an internal issue with the users on our network, then I got a complaint from...

Read more

10.6.2 Dovecot Mail Backups

Before migrating to 10.6 Server we were running our entire mailstore on the 10.5.8 platform. Say what you will about Leopard, once we had it set up correctly it ran fine. We migrated because of the greater benefits of Dovecot over Cyrus. Many of the other features intriqued us as well such as the improved Wiki server and iCal server. However we were really excited about Dovecots ability to repair itself basically doing away with the need to ever have to rebuild a users mailbox.

Read more

10.6.2 Squirrelmail, LDAP & Sieve

Snow Leopard 10.6 comes with built in Server Side rules (Sieve) that helps you to organize mail, if your like me and am supremely disappointed at the lack of functionality then you will be happy to know that there are alternatives out there. Snow Leopard still ships with a copy of Squirrel mail for OSX it also ships with many cool plugins for squirrel mail already installed. Lets look at the alternative to the built in Sieve scripts that ship with 10.6 Snow Leopard server.

Read more

10.6.2 Roundcube & LDAP

So like many other organizations mine was finally fed up with Horde as a webmail system. They had used squirrel mail in the past and was unimpressed by the graphical interface but admitted that it while it lacked glamour it always did perform as they would have expected. Before I had started there their mail system was running on a Linux box using Plesk and running Horde as their primary webmail interface. Immediately I got them into an XServe running OSX mail since their entire organization consisted of Apple iMacs...

Read more

10.5.8 Server Upgrade : Mail

Recently I have undergone a massive change, we have decided at our organization to go with Snow Leopard server in place of our Leopard Servers. Knowing that this could be problematic to use Apples built in GUI for migrating data I decided to start with a 100% clean configured Snow Leopard server and slowly start to migrate items over to the new server. Our current Leopard Server was running an DNS, Open Directory Master, Mail, and Wiki Server services. I have decided to share my experience in migrating our mail...

Read more

Roll your own DNS monitoring with DIG, Bash & CRON

If your like me your always looking for ways to be notified of things changing in your IT Environment. There are many tools that you can use to help do this. StatusCake is a great free online tool for monitoring website and IP level uptime and downtime with baked in email notifications. Zeonoss and NAGIOS are great tools that can offer the same with SNMP Monitoring baked in as well.

Read more

Authenticate with AD credentials via ARD / SSH

Binding a Mac to an AD is fairly straight forward. Most Mac Admin's worth their salt, know how this is done, many know how to do this via the command line. Once your Mac is bound, authentication is easy, local authentication that is. But what if you want to use your secure AD credentials over an SSH or Apple Remote Desktop connection? Well thats when things need a bit more configuration. Having recently deployed a series of servers with this configuration I figured I would share some of the commands...

Read more