Chapter 11. Remote Mail Delivery

Remote mail delivery is actually somewhat simpler than local mail delivery, because there’s really only one way to deliver remote mail: locate a suitable host for the message and deliver the mail to that host.

Telling Local from Remote Mail

Any domain that is listed in locals or virtualdomains is local. Anything else is remote. Note in particular that whether a domain appears in rcpthosts or morercpthosts has no bearing on whether it’s local or remote. (If a domain is in rcpthosts but isn’t local, that makes this host a backup or secondary MX for the domain, which I discuss later in this chapter.)

qmail-remote

As we saw in Chapter 2, the main qmail-send daemon passes remote deliveries to qmail-rspawn, which runs qmail-remote to attempt each delivery. The arguments to qmail-remote are the remote hostname, the envelope sender, and the envelope recipients, with the message to send on its standard input. Within qmail, qmail-remote is always run with a single recipient, and the host is the domain part of the recipient address. Other applications can use qmail-remote as a simple mail sending application, with as many recipients per message as desired.

Once qmail-remote has attempted delivery, it writes recipient report(s) and a message report to its standard output. The format of the reports is documented in the qmail-remote manpage.

Locating the Remote Mail Host

qmail-remote can identify the remote host for a message in two ways. If the smtproutes control ...

Get qmail now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.