This guide explains how to list the mail delivery methods available on your system—useful when you need to check what options exist for sending email from a server or application. You’ll see the command-line tools and configuration files involved, and learn how to interpret the output. No special software is required beyond a standard Linux or Unix system with a mail server installed.
What You’ll Need
- A Linux or Unix-like system (such as Ubuntu, Debian, CentOS, or macOS) with a command-line terminal.
- Basic familiarity with the command line and the ability to run commands with appropriate permissions (often as a regular user, sometimes with
sudo). - An installed mail transfer agent (MTA) like Postfix, Exim, or Sendmail. If none is installed, the commands below will not work.
Step-by-Step
- Open a terminal on your system. If you’re on a remote server, connect via SSH.
- Check if a mail server is installed by running
which sendmailorwhich postfix. If you see a path like/usr/sbin/sendmail, a mail server is present. If not, you may need to install one first (e.g.,sudo apt install postfixon Debian-based systems). - List the delivery methods using the
mailqcommand (if available). This shows the mail queue, but it also lists the mail server’s configured delivery methods in some implementations. Runmailqand look for lines that mention ‘delivery’ or ‘transport’. If it only shows queued messages, proceed to the next step. - Use the
postconfcommand (Postfix only). If your system uses Postfix, runpostconf -d | grep '^default_transport'to see the default delivery transport. To see all configured transports, runpostconf -d | grep 'transport_maps'and then check the referenced file (often/etc/postfix/transport) for custom entries. - Inspect the main configuration file. For Postfix, open
/etc/postfix/main.cfand look for lines likedefault_transport = smtp,relay_transport = relay, orlocal_transport = local. For Exim, check/etc/exim4/update-exim4.conf.confor the main config file for ‘transport’ sections. For Sendmail, look at/etc/mail/sendmail.cffor lines starting with ‘M’ (e.g.,Msmtp,Mlocal). - Run the
sendmail -btcommand (Sendmail and compatible MTAs). This enters test mode. Type0and press Enter to list all delivery agents (mailers). You’ll see a list likemailer 0: local,mailer 1: prog,mailer 2: smtp, and so on. TypeCtrl-Dto exit. - Check the
aliasesfile for local delivery. Runcat /etc/aliases(ornewaliasesto update). This shows how local mail is delivered (e.g., to user mailboxes or to external addresses). - Use the
ls -l /var/spool/mailcommand to see the local mail spool directory. This shows which delivery method is used for local mail (usually ‘mbox’ or ‘Maildir’). If you see files, it’s mbox; if you see directories, it’s Maildir. - For a comprehensive list, use
postconf -m(Postfix). This lists all available delivery transports (e.g., smtp, local, virtual, pipe). Note that this shows what’s compiled in, not necessarily what’s active. - Check the system log for delivery method clues. Run
grep 'delivery' /var/log/mail.log(or/var/log/maillog) and look for lines like ‘status=sent (delivered via smtp)’ or ‘delivered to mailbox’.
Common Mistakes
- Assuming the default MTA is Postfix. Many systems use Exim or Sendmail; the commands differ. Always check which MTA is running first.
- Running commands without proper permissions. Some commands like
postconfmay need root access to show full configuration. If you get a permission error, usesudo. - Confusing ‘delivery methods’ with ‘mail protocols’. Delivery methods refer to how mail is handed off (e.g., SMTP, local, pipe), not protocols like POP3 or IMAP for retrieval.
- Ignoring the transport map. If you have a transport map, the default transport may be overridden for certain domains. Check both.
- Expecting a single command to show everything. The delivery methods are spread across configuration files and commands. You need to combine several checks.
Tips
- Use
man postconf,man sendmail, orman eximto understand the specific options for your MTA. - If you’re testing, create a simple mail alias and send a test message to see which transport is used in the logs.
- Remember that delivery methods can be changed by editing the configuration files, but always test after making changes.
- For Postfix, the
postconf -dshows default values, whilepostconf -nshows non-default (custom) values. Use both to get the full picture. - Keep a backup of configuration files before editing.
Troubleshooting
- If
mailqsays ‘mail queue is empty’, that’s normal—it doesn’t list delivery methods. Use the other methods above. - If
postconfis not found, Postfix is not installed. Install it with your package manager, or check if Exim/Sendmail is present. - If
sendmail -btgives an error like ‘sendmail: not found’, your system may use a different MTA. Tryexim -bVorpostfix check. - If you see ‘Permission denied’ when reading config files, use
sudoto read them. - If the log file doesn’t exist, check
/var/log/syslogorjournalctl -u postfix(or the equivalent for your MTA).
Frequently Asked Questions
Q: What is a mail delivery method?
A: It’s the way a mail server hands off an email message—for example, via SMTP to another server, locally to a mailbox, or to a program like a spam filter.
Q: Can I have multiple delivery methods on one system?
A: Yes, most MTAs allow you to define different transports for different domains or recipients, using transport maps or rules.
Q: Why does my system show ‘local’ as a delivery method?
A: ‘Local’ means mail is delivered to a local user’s mailbox on the same server, typically to a file in /var/mail or a Maildir directory.
Q: How do I change the default delivery method?
A: Edit the MTA’s configuration file (e.g., set default_transport = smtp in Postfix) and reload the service. Be careful to test.
Q: What’s the difference between ‘smtp’ and ‘relay’ transports?
A: ‘SMTP’ is used to deliver mail directly to the recipient’s server, while ‘relay’ is used to forward mail through an intermediate server (like a smart host).
Q: Is there a GUI to view delivery methods?
A: Some control panels (like cPanel or Webmin) provide a web interface, but on a standard server, command-line tools are the norm.