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.
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.
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.
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.
Append fetched mail to the specified batched sendmail (BSMTP) file. If file is -, send to standard output.
Set the maximum number of messages (n) accepted from a server per query.
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.
Specify the domains to which mail should be sent when operating in ETRN or ODMR mode.
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.
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.
Keep copies of all retrieved messages on the mail server.
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.
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.
Do not expand local mail IDs to full addresses. This option will disable expected addressing and should be used only to find problems.
Do not bounce error messages back to the sender; send them to the postmaster instead.
Turn off logging to syslogd. This option overrides resource file settings and the -L option.
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:
Attempt IMAP, POP3, then POP2.
Post Office Protocol 2.
Post Office Protocol 3.
POP3 with MD5 authentication.
POP3 with Kerberos v4 authentication on port 1109.
POP3 with RPOP authentication.
Demon Internet's Standard Dial-up POP3 Service.
IMAP2bis, IMAP4, or IMAP4rev1. fetchmail autodetects their capabilities.
Extended SMTP with Extended TURN command.
On Demand Mail Relaying.
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.
Same as the --plugin option, but used to establish SMTP connections.
Authenticate using the specified service principal. Used with POP3 or IMAP with Kerberos authentication.
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.
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.
Suppress status messages during a fetch.
Always display progress dots. By default, fetchmail prints progress dots only when the current tty is standard output.
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.
Redirect status and error messages to the syslog daemon.
Encrypt connection to mail server using Secure Socket Layer.
Specify the file containing the client-side public SSL certificate.
Specify the file containing the client-side private SSL key.
Specify a specific SSL protocol to use. proto may be ssl2, ssl3, or tls1.
Fail unless the server's certificate has been signed by a local list of trusted certificates. proto may be ssl2, ssl3, or tls1.
Specify the directory containing trusted certificates to be used with --sslcertck.
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.
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.
For POP3, track the age of kept messages via unique ID listing.
Display all status messages during a fetch.
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.