Retrieving Mail Messages
As we’ve already seen, sites that connect intermittently to the
Internet can complicate mail relaying and delivery. The central issue
for such sites is the method for forcing mail to be sent and retrieved
periodically in some automated way. Basically, the local queue needs to
be flushed (e.g., via sendmail -q or
postfix flush) when the connection is
made, and mail for local users needs to be retrieved. (Of course, these
two processes can be handled by different servers and so need not happen
at the same time). Sending local mail is easily handled by adding the
appropriate command to the connection script (or creating a script that
activates the connection, flushes the queue, and then terminates the
connection).
Retrieving mail can be performed manually via the SMTP ETRN command on remote servers that allow SMTP connections and support the enhanced SMTP protocol. Here is an example:
#telnet kevin.ahania.com 25Trying 10.0.19.223... Connected to kevin. Escape character is `^]'. 220 kevin.ahania.com ESMTP Sendmail 8.11.0/8.11.0; Mon, 16 Apr 2001 11:22:54 -0400EHLO astarte250 kevin.ahania.com Hello astarte ...ETRN mailhost.zoas.org
The final command requests mail for the specified host.
The fetchmail program, written
by Eric Raymond, provides automated mail retrieval capabilities. It is a powerful program that supports a variety of transport protocols and authentication mechanisms. It operates by retrieving messages from a remote mail server and sending them ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access