LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


Linux in a Nutshell

This directory of Linux commands is from Linux in a Nutshell, 5th Edition.

Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.

Buy it now, or read it online on Safari Bookshelf.



fetchmail

fetchmail [options] [servers...]

System administration command. Retrieve mail from mail servers and forward it to the local mail delivery system. fetchmail retrieves mail from servers that support the common mail protocols POP2, POP3, IMAP2bis, and IMAP4. Messages are delivered via SMTP through port 25 on the local host and through your system's mail delivery agent (such as sendmail), where they can be read through the user's mail client. fetchmail settings are stored in the ~/.fetchmailrc file. Parameters and servers can also be set on the command line, which will override settings in the .fetchmailrc file. fetchmail is compatible with the popclient program, and users can use both without having to adjust file settings.

Options

-a,--all

Retrieve all messages from server, even ones that have already been seen but are left on the server. The default is to retrieve only new messages.

--auth type

Specify an authentication type. type can be: password, kerberos_v5, kerberos, gssapi, cram-md5, otp, ntlm, ssh, or any. When using the default value, any, fetchmail will use the highest authentication available. In decreasing order of security, types are gssapi, kerberos, cram, x-otp, ntlm, and login. Using ssh suppresses authentication. Use ssh when using an end-to-end secure connection.

-b n,--batchlimit n

Set the maximum number of messages sent to an SMTP listener per connection. When this limit is reached, the connection will be broken and reestablished. The default of 0 means no limit.

-bsmtp file

Append fetched mail to the specified batched sendmail (BSMTP) file. If file is -, send to standard output.

-B n,--fetchlimit n

Set the maximum number of messages (n) accepted from a server per query.

-c,--check

Check for mail on a single server without retrieving or deleting messages. Works with IMAP, and is partially functional for POP3 systems, but not POP2 systems.

-d n,--daemon n

Detach from current process and run as a daemon, fetching mail every n seconds. A user may run only one fetchmail daemon process. See option --quit.

-D [domain] ,--smtpaddress [domain]

Specify the domain name placed in RCPT TO lines sent to SMTP. The default is the local host.

-e n,--expunge n

Tell an IMAP server to EXPUNGE (i.e., purge messages marked for deletion) after n deletes. A setting of 0 indicates expunging only at the end of the session. Normally, an expunge occurs after each delete.

-E header,--envelope header

Change the header assumed to contain the mail's envelope address (usually "X-Envelope-to:") to header.

-f file,--fetchmailrc file

Specify a nondefault name for the fetchmail configuration file.

--fetchdomains hosts

Specify the domains to which mail should be sent when operating in ETRN or ODMR mode.

-F,--flush

For POP3 and IMAP servers, remove previously retrieved messages from the server before retrieving new ones.

-i file,--idfile file

Store POP3 UIDs in file instead of the default .fetchids file.

--invisible

Suppress Received header and spoof the MTA so it looks like mail comes directly from the mailserver host.

-I specification,--interface specification

Require that the mail server machine is up and running at a specified IP address (or range) before polling. The specification is given as interface/ipaddress/mask. The first part indicates the type of TCP connection expected (sl0, ppp0, etc.), the second is the IP address, and the third is the bit mask for the IP, assumed to be 255.255.255.255.

-k,--keep

Keep copies of all retrieved messages on the mail server.

-K,--nokeep

Delete all retrieved messages from the mail server.

-l size,--limit size

Set the maximum message size that will be retrieved from a server. Messages larger than this size will be left on the server and marked unread.

-lmtp

Deliver fetched mail via LMTP instead of SMTP. The server, specified with the -S option, must explicitly include the port to be used.

-L file,--logfile file

Redirect status messages to the specified file. This option is primarily for use in debugging. See the --syslog option.

-m command,--mda command

Pass mail directly to mail delivery agent instead of sending to port 25. The command is the path and options for the mailer, such as /usr/lib/sendmail -oem. A %T in the command will be replaced with the local delivery address, and an %F will be replaced with the message's From address.

-M interface,--monitor interface

In daemon mode, monitor the specified TCP/IP interface for any activity besides itself, and skip the poll if there is no other activity. Useful for PPP connections that automatically time out with no activity.

-n,--norewrite

Do not expand local mail IDs to full addresses. This option will disable expected addressing and should be used only to find problems.

--nobounce

Do not bounce error messages back to the sender; send them to the postmaster instead.

--nosyslog

Turn off logging to syslogd. This option overrides resource file settings and the -L option.

-N,--nodetach

Run command in the foreground. Useful for debugging a configuration file that normally would run fetchmail as a daemon. Also causes fetchmail to ignore -L or --syslog options.

-p proto,--protocol proto

Specify the protocol to use when polling a mail server. proto can be:

AUTO

Attempt IMAP, POP3, then POP2.

POP2

Post Office Protocol 2.

POP3

Post Office Protocol 3.

APOP

POP3 with MD5 authentication.

KPOP

POP3 with Kerberos v4 authentication on port 1109.

RPOP

POP3 with RPOP authentication.

SDPS

Demon Internet's Standard Dial-up POP3 Service.

IMAP

IMAP2bis, IMAP4, or IMAP4rev1. fetchmail autodetects their capabilities.

ETRN

Extended SMTP with Extended TURN command.

ODMR

On Demand Mail Relaying.

--plugin command

Use external program to establish the TCP connection. The command is the path and options for the external program. Use escape codes %h and %p in command to pass the hostname and port as arguments to the external program. When using this command, fetchmail will write to the program's standard input and read from its standard output.

--plugout command

Same as the --plugin option, but used to establish SMTP connections.

--principal principal

Authenticate using the specified service principal. Used with POP3 or IMAP with Kerberos authentication.

--postmaster name

If unable to deliver mail, deliver it to name. Set name to "" to have undeliverable mail discarded.

-P n,--port n

Specify a port to connect to on the mail server. The default port numbers for supported protocols are usually sufficient.

-q,--quit

Kill a running daemon process before performing any other commands.

-Q string,--qvirtual string

Remove the prefix string, which is the local user's hostid, from the address in the envelope header (such as "Delivered-To:").

-r folder,--folder folder

Retrieve the specified mail folder from the mail server.

-s,--silent

Suppress status messages during a fetch.

--showdots

Always display progress dots. By default, fetchmail prints progress dots only when the current tty is standard output.

--smtpname user

Specify the user and domain name to use in RCPT TO lines sent to SMTP. user should be in the form user@domain. By default, fetchmail uses the local user and domain.

--syslog

Redirect status and error messages to the syslog daemon.

--ssl

Encrypt connection to mail server using Secure Socket Layer.

--sslcert file

Specify the file containing the client-side public SSL certificate.

--sslkey file

Specify the file containing the client-side private SSL key.

--sslproto proto

Specify a specific SSL protocol to use. proto may be ssl2, ssl3, or tls1.

--sslcertck

Fail unless the server's certificate has been signed by a local list of trusted certificates. proto may be ssl2, ssl3, or tls1.

--sslcertpath directory

Specify the directory containing trusted certificates to be used with --sslcertck.

--sslfingerprint hash

Fail unless the server's key fingerprint matches the specified fingerprint hash. hash is an MD5 hash of the server's key given in hexadecimal notation, using colons to separate groups of two digits. Letter hex digits must be in uppercase.

-S hostlist,-smtphost hostlist

Attempt to forward mail to one of the SMTP hosts listed in the comma-separated hostlist. The hosts are tried in the order they are given. The host may be a domain name, IP address, or the directory path to an LMTP socket. Port numbers can be appended to domain names and IP addresses using /port notation.

-t n,--timeout n

Set the nonresponse timeout to n seconds.

--tracepolls

Add information about the account and server being polled to the Received header of each message received.

-u name,--username name

Specify the user name to use when logging into the mail server.

-U,--uidl

For POP3, track the age of kept messages via unique ID listing.

-v,--verbose

Display all status messages during a fetch.

-V,--version

Print the version information for fetchmail and display the options set for each mail server. Perform no fetch.

-w n,--warnings n

When issuing warnings about oversized messages, wait n seconds after each warning before sending another warning.

-Z nnn,--antispam nnn

Specify the SMTP error nnn to signal a spam block from the client. If nnn is -1, this option is disabled. Multiple SMTP codes may be given as a comma-separated list. By default, fetchmail discards messages with error codes 571, 550, 501, and 554.


Linux Resources
  • Linux Online
  • The Linux FAQ
  • linux.java.net
  • Linux Kernel Archives
  • Kernel Traffic
  • DistroWatch.com


  • Sponsored by: