Linux web hosting and server support tips

Tag: outbound

How to block Outgoing Port 25 for all VPS/Containers of SolusVM

How to block Outgoing Port 25 for all VPS/Containers of SolusVM(Both OpenVZ/KVM)

Sometimes,when providing VPS service, it is necessary to block mailing service for VPS. Otherwise your IP ranges will be blocked by RBLs and other common mail providers like Gmail, Hotmail, AOL, etc. It is recommended to open ports by case by case for your customers, after establishing trust with your client.

Normally we block the port using the “OUTPUT” chain. However, SolusVM uses the chain “FORWARD” for routing traffic from containers/VPSs.

So by adding following rules, you can block all outgoing mails ports completely for all VPSs.

iptables -I FORWARD -d -p tcp -m tcp --dport 25 -j DROP
iptables -I FORWARD -d -p tcp -m tcp --dport 465 -j DROP
iptables -I FORWARD -d -p tcp -m tcp --dport 587 -j DROP

Then save the iptables by running

service iptables save

Disable/suspend email service for one domain – cPanel

Disable/suspend email service for one domain

From version 56, cPanel provides API support to disable email service for domain or email accounts. Please note this limit cannot be override by the user from their cPanel. This can be very helpful if there is any spamming activity and you just want to disable the email service feature for the domain for the time being.

You can run the below commands through SSH console

To suspend email service for a the cPanel user “aacenyor”

whmapi1 suspend_outgoing_email user=aacenyor

For unsuspending the account, please run the below command:

whmapi1 unsuspend_outgoing_email user=aacenyor

If you are not comfortable with SSH, you can also call these through browser XML.


To suspend

where replace with your hostname
replace cpsess########## with WHM session id.

To un suspend

For older versions cPanel, you may refer to this below forum from cPanel. There is a workaround

Email sending limits and throttling – iRedmail free edition

iRedMail is:
1. A ZERO COST, fully fledged, full-featured mail server solution. All components are free and open source software
2. It support unlimited domains and email accounts.
2. SpamAssassin, ClamAV, SPF, DKIM, greylisting, whitelisting, blacklisting.
3. Stores mail accounts in your favorite backend: OpenLDAP, MySQL, MariaDB, PostgreSQL.
4. Supports major Linux distros


iRedmail supports following level of throttling for email limits.
Global, per-domain and per-user throttling based on: max size of single message, number of max inbound/outbound messages per time unit.

iRedmail uses a component named iredpad for this. With iRedmail Pro version, you can configure these settings through GUI(iRedadmin panel). However they are not available through GUI for free version. The feature is enabled though we will have to modify them through database directly.

So the database is “iredapd” and table is “throttle”.

Here are some examples

1. Allow user `` to send 50 mails in 5 minutes (period=300):

INSERT INTO throttle (account, kind, priority, period, msg_size, max_msgs, max_quota) VALUES (‘’,’outbound’,100,300,0,50,0);

2. Set global limit of 500 mails per day and a maximum single mail size of 55MB

INSERT INTO throttle (account, kind, priority, period, msg_size, max_msgs, max_quota) VALUES (‘@.’,’outbound’,0,86400,57671680,500,0);

57671680 bytes = 55MB
86400 – 1 Day

# Technical details of throttle plugin
# ————-
# Currently you may throttle based on:
# – amount of mails sent over a given period of time
# – accumulated mail size sent over a given period of time
# – size of singe message
# Eg: You can enforce that does not send more than 1000 mails
# or 1GB of mail (whichever limit is hit first) in 5 minute.
# Possible throttling address:
# *) Full email address:
# *) Domain name (with a prefixed ‘@’):
# *) Sub-domain name (with a prefixed ‘@.’):
# *) IP address:
# *) IP network: 192.168.1.*
# *) Catch-all for email address: ‘@.’ (note, the dot is required)
# *) Catch-all for IP address: ‘@ip’
# Priorities of different thorttle address (larger digital number has higher priority):
# *) email: 100 # e.g. ‘’. Highest priority
# *) wildcard_addr: 90 # e.g. `user@*`. used in plugin `amavisd_wblist`
# # as wildcard sender. e.g. ‘user@*`
# *) ip: 80 # e.g.
# *) wildcard_ip: 70 # e.g. 173.254.22.*
# *) cidr: 70 # e.g.
# *) domain: 60 # e.g.
# *) subdomain: 50 # e.g.
# *) top_level_domain: 40 # e.g. @com, @org
# *) catchall: 0 # ‘@.’. Lowest priority

Please note that priority for global setting is 0 and priority of a single user is 100.

Powered by WordPress & Theme by Anders Norén