\. /* Copyright 1993-95 by Carl Harris, Jr.
\. * All rights reserved
\. * Distribute freely, except: don't remove my name from the source or
\. * documentation (don't take credit for my work), mark your changes (don't
\. * get me blamed for your possible bugs), don't alter or remove this
\. * notice. May be sold if buildable source is provided to buyer. No
\. * warrantee of any kind, express or implied, is included with this
\. * software; use at your own risk, responsibility for damages (if any) to
\. * anyone resulting from the use of this software rests entirely with the
\. * user.
\. * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
\. * I'll try to keep a version up to date. I can be reached as follows:
\. * Carl Harris <firstname.lastname@example.org>
\. $Log: fetchmail.man,v $
\. Revision 1.1 1996/06/24 19:30:36 esr
\. Initial revision
\. Revision 1.4 1995/09/07 22:53:49 ceharris
\. One last bit of crap before the 3.0b4 release
\. Revision 1.3 1995/08/14 18:36:46 ceharris
\. Patches to support POP3's LAST command.
\. Final revisions for beta3 release.
\. Revision 1.2 1995/08/08 01:01:29 ceharris
\. Added GNU-style long options processing.
\. Fixed password in 'ps' output problem.
\. Fixed various RCS tag blunders.
\. Integrated .poprc parser, lexer, etc into Makefile processing.
.TH popclient LOCAL
popclient \- retrieve mail from a mailserver using Post Office Protocol.
[\fI options \fR] \fI server-host [server-host...]\fR
is a Post Office Protocol compliant mail retrieval client which supports
both POP2 (as specified in RFC 937) and POP3 (RFC 1725).
will be used to download mail in batch from the remote mailserver specified by
to a mail folder on the local disk. The retrieved mail will then be
manipulated using a local mail reader, such as
To facilitate the use of
in scripts, pipelines, etc, it returns an appropriate exit code upon
termination -- see EXIT CODES below.
Use Post Office Protocol version 2 (POP2). See also the
Use Post Office Protocol version 3 (POP3). See also the
.B \-a, --all
POP3 only. Retrieve both old (previously retrieved) and new messages from
.B \-c, --stdout
Causes retrieved messages to be written to stdout instead of a mail folder.
See OUTPUT OPTIONS below for a complete description. You may not specify
options on the same command line.
.B \-F, --flush
POP3 only. Delete old (previously retrieved) messages from the mailserver
before retrieving new messages.
.B \-f pathname, --poprc pathname
Specify an alternate name for the .poprc file.
.B \-k, --keep
Keep retrieved messages in folder on remote mailserver. Normally, messages
are deleted from the folder on the mailserver after they have been retrieved
was compiled with the KEEP_IS_DEFAULT option). Specifying the
option causes retrieved messages to remain in your folder on the mailserver.
.B \-K, --kill
Delete retrieved messages from the remote mailserver. If
is compiled with the KEEP_IS_DEFAULT option, the
option forces retrieved mail to be deleted.
.B \-l lines, --limit lines
POP3 only. Retrieve no more than the specified number of lines of each
message body (plus message headers). The
option is implied by the
option -- i.e. messages downloaded with the
option remain on the remote mailserver.
.B \-p string, --password string
Specifies the password
to be used when logging-in to the mailserver. The
appropriate password is both server and user dependent. If the
option is not used to specify a password, you will be prompted
for a password before the connection to the mailserver is established.
See USER AUTHENTICATION below for a complete description.
.B \--protocol proto
Specify the protocol to used when communicating with the remote
may be one of the following:
Post Office Protocol 2
Post Office Protocol 3
Use POP3 with MD5 authentication.
Use POP3 with trusted-host-based authentication (like rlogin/rsh).
must be installed as a setuid root program to use RPOP.
.B \-o folder, --local folder
Causes retrieved messages to be appended to file named by the folder
argument. When neither
is specified, retrieved messages are appended to the system default mail
folder. See OUTPUT OPTIONS below for a complete description.
.B \-r folder, --remote folder
Causes an alternate mail folder on the mailserver to be retrieved. The
syntax of the folder name is server dependent, as is the default behavior
when no folder is specified. Fortunately, most POP servers have a reasonable
default behavior, so use of this option should be limited to fairly specialized
applications. POP3 does not provide a folder specification in the protocol.
option is used in conjunction with the POP3 protocol, the remote folder
specification is ignored.
.B \-s, --silent
Silent mode. Suppresses all progress/status messages that are normally
echoed to stderr during a POP connection. If both the
options are specified, the
option takes precedence.
.B \-u name, --username name
Specifies the user idenfication to be used when logging-in to the mailserver.
The appropriate user identification is both server and user dependent.
The default is your login name on the machine that is running
See USER AUTHENTICATION below for a complete description.
.B \-v, --verbose
Verbose mode. All control messages passed between
and the mailserver are echoed to stderr. Specifying
causes normal progress/status messages which would be redundant or meaningless
to be modified or omitted.
.B \-V, --version
Displays the version information for your copy of
If you specify the
option, all other options are ignored and no POP connection is made.
.SH PROTOCOL SELECTION
The selection of the correct Post Office Protocol (POP2 or POP3) depends upon
the configuration of the mailserver from which you retrieve your mail. The
system adminstrator who installed
on your system should have chosen an appropriate default protocol for your
mailserver. If you get the message 'Connection refused' when using the
default protocol, try specifying
to select a different protocol. If the 'Connection refused' message persists
regardless of the protocol selected, it is likely that your mailserver is not
running a POP compliant mail service.
.SH USER AUTHENTICATION
User authentication in
is very much like the authentication mechanism of
The correct user-id and password depend upon the underlying security
system at the mailserver.
If the mailserver is a Unix machine on which you have an ordinary user
account, your regular login name and password are used with
If you use the same login name on both the server and the client machines,
you needn't worry about specifying a user-id with the
the default behavior will use your login name on the client machine as the
user-id on the server machine. If you use a different login name
on the server machine, specify that login name with the
option. e.g. if your login name is 'jsmith' on a machine named 'mailgrunt',
you would start
popclient -u jsmith mailgrunt
The default behavior of
is to prompt you for your mailserver password before the POP connection is
established. This is the safest way to use
and ensures that your password will not be compromised. You may also specify
your password using the
option. This is convenient when using
with automated scripts, but it may result in your password being exposed to
prying eyes \-\- be careful! Regardless of how your password is specified
it is never stored in shared memory segments, or left unencrypted in the core
terminates. Continuing the preceding example, suppose your password on
\'mailgrunt' is 'Gr8PassWd'. The syntax would be:
popclient -u jsmith -p Gr8PassWd mailgrunt
On mailservers that do not provide ordinary user accounts, your user-id and
password are usually assigned by the server administrator when you apply for
a mailbox on the server. Contact your server administrator if you don't know
the correct user-id and password for your mailbox account.
.SH OUTPUT OPTIONS
always writes the retrieved messages using Unix mail folder format. This
to be used in conjunction with common mail readers like
The retrieved messages are normally appended to your default system mailbox
on the local disk, using the local Mail Delivery Agent (MDA), usually
/bin/mail(1), so that when you invoke your mail reader it can manipulate the
retrieved messages like any other mail you receive on the client machine.
option, you can specify a different mail folder to which the retrieved
messages will be appended. If you prefer, for example, to have your POP
mail from a machine called 'mailgrunt' stored in the
file in your home directory, you would start
popclient \-o $HOME/mbox mailgrunt
Note that the folder specified with
is not locked or otherwise protected from other processes writing to it
while popclient is writing to it.
can be used in a shell pipeline by using the
option. In this mode,
writes the retrieved messages to stdout, instead of a mail folder. This would
allow you, for instance, to pass the incoming mail through a filter that
discards mail marked as 'Precedence: junk'. Suppose you've written an AWK
script called 'dumpjunk.awk' to implement a junk mail filter. The appropriate
syntax to retrieve your mail from 'mailgrunt', pass it through the filter,
and write it to a folder called 'realmail' in your home directory would be:
popclient -c mailgrunt | awk -f dumpjunk.awk > $HOME/realmail
The progress/status messages written to stderr when the
option has not been specified, do not interfere with the message stream, which
is written to stdout. You may even use
together without corrupting the message stream. It is a good idea to use the
option when using
to insure that your messages will not be lost if part of the shell pipeline
does not function incorrectly. The safest bet would be something like:
popclient -k -c mailgrunt | myfilter > $HOME/filtered.mail
popclient -c mailgrunt > /dev/null
when you're sure the messages were correctly processed by 'myfilter'.
.SH EXIT CODES
To facilitate the use of
in shell scripts and the like, an exit code is returned to give an indication
of what occured during a given POP connection. The exit code can be tested
by the script and appropriate action taken.
A simple example follows. This Bourne shell script executes
and, if some messages were successfully retrieved from a mailserver retrieved
from the command line, it starts the
utility to read those messages. Otherwise, it prints a brief message, and
if popclient $1
echo "No mail to read."
The exit codes returned by
are as follows:
One or more messages were successfully retrieved.
There was no mail awaiting retrieval.
An error was encountered when attempting to open a socket for the POP
connection. If you don't know what a socket is, don't worry about it --
just treat this as an 'unrecoverable error'.
The user authentication step failed. This usually means that a bad
user-id or password was specified.
Some sort of protocol error was detected. POP is not especially forgiving
when it comes to unexpected responses, commands, etc -- the protocol invariably
calls for terminating the connection under such error conditions.
There was a syntax error in the arguments to
Some kind of I/O woes occurred when writing to the local folder.
There was an error condition reported by the server (POP3 only).
Something totally undefined occured. This is usually caused by a bug within
Do let me know if this happens.
was written by Carl Harris at Virginia Polytechnic Institute and State
University (a.k.a. Virginia Tech).
There are none! Well, maybe one or two. Send comments, bug reports, gripes,
and the like to email@example.com.
.SH SEE ALSO
mail(1), binmail(1), sendmail(8), popd(8), RFC 937, RFC 1225.