Amazon Cyber Monday deals See deals →ad

List Mail Delivery Methods: A Practical How-To

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

  1. Open a terminal on your system. If you’re on a remote server, connect via SSH.
  2. Check if a mail server is installed by running which sendmail or which 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 postfix on Debian-based systems).
  3. List the delivery methods using the mailq command (if available). This shows the mail queue, but it also lists the mail server’s configured delivery methods in some implementations. Run mailq and look for lines that mention ‘delivery’ or ‘transport’. If it only shows queued messages, proceed to the next step.
  4. Use the postconf command (Postfix only). If your system uses Postfix, run postconf -d | grep '^default_transport' to see the default delivery transport. To see all configured transports, run postconf -d | grep 'transport_maps' and then check the referenced file (often /etc/postfix/transport) for custom entries.
  5. Inspect the main configuration file. For Postfix, open /etc/postfix/main.cf and look for lines like default_transport = smtp, relay_transport = relay, or local_transport = local. For Exim, check /etc/exim4/update-exim4.conf.conf or the main config file for ‘transport’ sections. For Sendmail, look at /etc/mail/sendmail.cf for lines starting with ‘M’ (e.g., Msmtp, Mlocal).
  6. Run the sendmail -bt command (Sendmail and compatible MTAs). This enters test mode. Type 0 and press Enter to list all delivery agents (mailers). You’ll see a list like mailer 0: local, mailer 1: prog, mailer 2: smtp, and so on. Type Ctrl-D to exit.
  7. Check the aliases file for local delivery. Run cat /etc/aliases (or newaliases to update). This shows how local mail is delivered (e.g., to user mailboxes or to external addresses).
  8. Use the ls -l /var/spool/mail command 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.
  9. 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.
  10. 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 postconf may need root access to show full configuration. If you get a permission error, use sudo.
  • 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, or man exim to 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 -d shows default values, while postconf -n shows non-default (custom) values. Use both to get the full picture.
  • Keep a backup of configuration files before editing.

Troubleshooting

  • If mailq says ‘mail queue is empty’, that’s normal—it doesn’t list delivery methods. Use the other methods above.
  • If postconf is not found, Postfix is not installed. Install it with your package manager, or check if Exim/Sendmail is present.
  • If sendmail -bt gives an error like ‘sendmail: not found’, your system may use a different MTA. Try exim -bV or postfix check.
  • If you see ‘Permission denied’ when reading config files, use sudo to read them.
  • If the log file doesn’t exist, check /var/log/syslog or journalctl -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.

List Mail Delivery Methods: A Practical How-To

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top