Troubleshooting Delivery Issues

The Definitive Guide to Advanced Mail Server Management: Expert Techniques and Best Practices

By the Domain India teamPublished 9 min read
Knowledge base article
Contents (7 sections)

Once your own mail server is sending and receiving, the real work begins: choosing and tuning the mail transfer agent, making Dovecot fast, filtering mail on the server, and keeping spammers and password-guessers out. This guide covers those advanced tasks for a server you run yourself, such as a VPS. It assumes you already have a working Postfix or Exim with Dovecot, and it applies to your own server only, not to shared hosting.

Key takeaways

Pick one MTA and stay with it: Postfix is simpler and secure by default, Exim is more flexible through its ACLs. Tune Dovecot with its split config files and check the result with doveconf -n. Filter mail server-side with Sieve (Pigeonhole), give users Roundcube with the managesieve and password plugins, and protect the server with SPF, DKIM and DMARC, a modern spam filter such as Rspamd, rate limits and Fail2ban. Watch the queue and the logs every day.

Own server only

Everything here needs root access on a VPS or dedicated server you manage. On Domain India shared hosting, the mail server is run for every account on the server and you can't change its configuration; use the email tools in your control panel instead. If you just want reliable mailboxes on your domain, Business Email (section 7) is far less work than running a mail server.

1. Postfix or Exim?

Both are mature, maintained and widely used. Choose on how you want to manage policy, not on speed.

QuestionPostfixExim
Default securitySecure by default; small, separated processesNeeds more care; flexible defaults
Configurationmain.cf and master.cf, key-value settingsOne config with routers, transports and ACLs
Custom policyRestrictions plus policy services and miltersACLs can express almost any rule inline
Packages (AlmaLinux/Rocky)Base OSEPEL repository
Used byMost distributions' defaultcPanel and DirectAdmin servers

Switching MTA on a live server is rarely worth it. If you must, do it in a maintenance window:

bash
# AlmaLinux / Rocky Linux example
sudo cp -a /etc/postfix /root/postfix-backup-$(date +%F)
sudo dnf install epel-release
sudo dnf install exim
sudo systemctl disable --now postfix
sudo alternatives --config mta        # choose sendmail.exim
sudo systemctl enable --now exim

Then rebuild your settings in Exim (relay rules, TLS certificate, authentication through Dovecot, local delivery to Dovecot over LMTP), test with exim -bV and exim -bh 203.0.113.10, and send test mail both ways. Mailboxes stored by Dovecot in Maildir don't need migrating, because Dovecot, not the MTA, owns them. MX records don't change either, as long as the server's hostname and IP stay the same.

For writing Exim rules, see the custom Exim ACL guide.

2. Tuning Dovecot

Check your version first with dovecot --version. The examples below use Dovecot 2.3 syntax, which AlmaLinux and Rocky Linux ship. Dovecot 2.4, found in newer distributions such as Debian 13, renamed many settings (for example, mail_location was replaced), so use the 2.4 documentation if that is what you run.

Settings live in /etc/dovecot/conf.d/, split by topic. Useful ones:

ini
# 10-mail.conf: Maildir in each user's home
mail_location = maildir:~/Maildir

# 20-imap.conf: connections per user from one IP (default 10)
protocol imap {
  mail_max_userip_connections = 20
}

# 10-master.conf: allow more simultaneous logins on a busy server
service imap-login {
  process_min_avail = 4
}
  • Raise mail_max_userip_connections only if users with several devices behind one office IP hit the limit.
  • Put mail on fast storage. Dovecot's index files make large folders fast, and NVMe storage helps most on busy servers.
  • Compression saves disk space for large archives; in 2.3 it is the zlib plugin, in 2.4 mail_compress.

After every change, check the effective config and reload:

bash
sudo doveconf -n | less
sudo systemctl reload dovecot

3. Server-side filtering with Sieve

Sieve filters run on the server as mail is delivered, so they work the same in every mail app. Install Pigeonhole (dovecot-pigeonhole on AlmaLinux and Rocky Linux), then enable it for local delivery:

ini
# 20-lmtp.conf
protocol lmtp {
  mail_plugins = $mail_plugins sieve
}

# 90-sieve.conf
plugin {
  sieve = file:~/sieve;active=~/.dovecot.sieve
}

A simple script that files tagged spam into the Junk folder:

sieve
require ["fileinto"];
if header :contains "X-Spam-Flag" "YES" {
  fileinto "Junk";
  stop;
}

Compile it with sievec and test it against a saved message with sieve-test. Enable the ManageSieve service so users can edit their own filters from webmail.

4. Webmail: Roundcube and alternatives

Roundcube is the standard choice and is actively maintained. Plugins worth enabling:

  • managesieve: users edit their Sieve filters and vacation replies;
  • password: users change their mailbox password;
  • markasjunk: users train the spam filter;
  • archive and zipdownload: tidy folders and download messages.

Enable plugins in config/config.inc.php (or /etc/roundcubemail/config.inc.php for a distribution package):

php
$config['plugins'] = ['archive', 'zipdownload', 'managesieve', 'password', 'markasjunk'];

Keep Roundcube updated; webmail faces the internet and is a frequent target. Maintained alternatives include SOGo (mail, calendar and contacts with ActiveSync) and SnappyMail. Avoid SquirrelMail and RainLoop, which are no longer maintained.

5. Security: stop abuse in and out

Authenticate your mail
Publish SPF, sign with DKIM and publish a DMARC policy for every domain you send from, or major providers will junk or reject you.
Filter spam
Rspamd is a fast, modern filter with greylisting, DKIM signing and a web interface built in; SpamAssassin still works if you already use it.
Rate-limit senders
Cap how much one account can send per hour, so one stolen password can't blacklist your IP.
Ban password guessers
Fail2ban reads the MTA and Dovecot logs and blocks IPs after repeated failed logins.

An Exim rate limit for authenticated senders, in the RCPT ACL:

exim
deny  authenticated = *
      ratelimit     = 200 / 1h / per_rcpt / strict / $authenticated_id
      message       = Sending rate limit exceeded, try again later

A DNS blocklist check in the same ACL:

exim
deny  dnslists = zen.spamhaus.org
      message  = Rejected: $sender_host_address is listed at $dnslist_domain
Blocklists need your own DNS resolver

Spamhaus refuses queries that come through large public resolvers, and it has usage terms for commercial and high-volume use. Run a local caching resolver such as Unbound on the mail server, and read the list operator's terms before you rely on it.

Also require TLS for logins (ports 465, 587, 993 and 995), disable plain-text authentication on unencrypted connections, and keep the OS and mail packages updated.

6. Monitoring and alerts

  • Queue size: mailq or postqueue -p for Postfix, exim -bpc for Exim. A queue that grows suddenly usually means a compromised account or a blocklisting.
  • Daily reports: Logwatch summarises logs; pflogsumm (Postfix) and eximstats (Exim) report volume, rejects and top senders.
  • Blocklist status: check your server IP against the major blocklists regularly, and after any spam incident.
  • Deliverability: watch DMARC aggregate reports and the postmaster tools of large mailbox providers.
  • Alerts: have your monitoring system alert on queue size, disk space and failed-login spikes, not only on the server being down.

7. Where Domain India fits

Your own mail server on a VPS. Our VPS plans give you root access and are self-managed, so the MTA, Dovecot, spam filtering and deliverability are yours to run. The VPS page says you can set custom reverse DNS (PTR) records for your IPs from the client area, which a mail server needs. Before you build, ask support whether outbound port 25 is open for your VPS.

VPS Starter
₹552.65/mo + GST
  • 1 vCPU
  • 2 GB DDR4 RAM
  • 64 GB NVMe SSD Storage
  • 2 TB Monthly Bandwidth
See plan details

Or let us run the mail. Business Email gives you mailboxes on your own domain without running a server: webmail with calendar, contacts and tasks, IMAP and SMTP over TLS, DKIM signing on every message, SPF and DMARC records provided, two-factor authentication, and mail filters. It is priced per mailbox.

Business Email
₹60/mo + GST
  • Priced per mailbox - start with one
  • Email at your own domain ([email protected])
  • Add and remove mailboxes yourself
  • Webmail with calendar, contacts and tasks
See plan details

The cards show live prices, excluding 18% GST. On 19 September 2026, Domain India list prices were ₹553 a month for VPS Starter and ₹60 a month per Business Email mailbox.

Should I use Postfix or Exim on my mail server?

Either works well. Postfix is simpler and secure by default, which suits most self-managed servers. Exim is more flexible because its ACLs can express almost any rule, and it is the MTA used by cPanel and DirectAdmin. Switching a working server is rarely worth the risk.

Do I need to migrate mailboxes when I switch from Postfix to Exim?

Usually not. When Dovecot stores the mailboxes in Maildir, Dovecot owns them and the MTA only delivers to it. You rebuild the MTA settings, point local delivery at Dovecot, and test.

Can I change the mail server settings on Domain India shared hosting?

No. On Domain India shared hosting the mail server is managed for every account on the server. Use the email, filter and spam tools in your control panel, or run your own mail server on a self-managed VPS.

Why does my self-hosted mail go to spam?

The usual causes are missing SPF, DKIM or DMARC records, no matching reverse DNS (PTR) record for the server IP, an IP on a blocklist, or a compromised account sending spam. Fix authentication first, then check the blocklists and your logs.

Is running my own mail server cheaper than Business Email?

Only if your time is free. A mail server needs constant patching, spam filtering, blocklist monitoring and deliverability work. For a small business, a managed mailbox such as Domain India Business Email is usually the better choice.

Ready to decide? If you want full control, start with a self-managed VPS. If you just want reliable mail on your domain, see Business Email. Questions? Open a support ticket or use the 24/7 live chat.

Want email without running a mail server?

Mailboxes on your own domain, with webmail, DKIM signing, SPF and DMARC records and two-factor authentication.

See Business Email

Ready when you are

Get Business Email from ₹60/mo + GST

See plans

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app
Advanced Mail Server Management on Your Own VPS