How does fetchmail work




















Place any desired configuration options in the. It is possible to override these at the time Fetchmail is run by specifying that option on the command line. A user's. These options affect every user using that server. Global options appear at the top of the. User options follow server options for each user account checking that email server. Like server options, multiple user options may be specified for use with a particular server as well as to check multiple email accounts on the same server.

Server options are called into service in the. The poll action tells Fetchmail to use this server option when it is run, which checks for email using the specified user options. Any server options after a skip action, however, are not checked unless this server's hostname is specified when Fetchmail is invoked.

The skip option is useful when testing configurations in the. The following is a sample example of a. In this example, the global options specify that the user is sent email as a last resort postmaster option and all email errors are sent to the postmaster instead of the sender bouncemail option. The set action tells Fetchmail that this line contains a global option. Then, two email servers are specified, one set to check using POP3 , the other for trying various protocols to find one that works.

Two users are checked using the second server option, but all email found for any user is sent to user1 's mail spool. If no port is specified, the connection is attempted to the well knownport of the SSL version of the base protocol. This is generally adifferent port than the port used by the base protocol. SomeSSL encrypted servers may require client side keys and certificates forauthentication. In most cases, this is optional. This specifiesthe location of the public key certificate to be presented to the serverat the time the SSL session is established.

It is not required but maybe provided if the server does not require it. Some servers mayrequire it, some servers may request it but not require it, and someservers may not request it at all. It may be the same fileas the private key combined key and certificate file but this is notrecommended. NOTE: If you use client authentication, the user name is fetched from thecertificate's CommonName and overrides the name set with --user.

Some SSLencrypted servers may require client side keys and certificates forauthentication. This specifiesthe location of the private key used to sign transactions with the serverat the time the SSL session is established. It may be the same fileas the public key combined key and certificate file but this is notrecommended. If a password is required to unlock the key, it will beprompted for at the time just prior to establishing the session to theserver. This can cause some complications in daemon mode.

Try this if the defaulthandshake does not work for your server. The default is to try appropriate protocols dependingon context.

If the servercertificate cannot be obtained or is not signed by one of the trusted ones directly or indirectly , the SSL connection will fail, regardless ofthe sslfingerprint option. Your systemclock should also be reasonably accurate when using this option. Note that this optional behavior may become default behavior in futurefetchmail versions.

The defaultis your OpenSSL default one. The letterhex digits must be in upper case. When this is specified, fetchmail will compare the server keyfingerprint with the given one, and the connection will fail if they do notmatch regardless of the sslcertck setting. The connection willalso fail if fetchmail cannot obtain an SSL certificate from the server. This can be used to prevent man-in-the-middle attacks, but the fingerprint from the server needs to be obtained or verified over a securechannel, and certainly not over the same Internet connection thatfetchmail would use.

Using this option will prevent printing certificate verification errorsas long as --sslcertck is unset. To obtain the fingerprint of a certificate stored in the file cert. Hosts are tried in list order; the firstone that is up becomes the forwarding target for the current run.

Ifthis option is not specified, 'localhost' is used as the default. Each hostname may have a port number following the host name. Theport number is separated from the host name by a slash; the defaultport is "smtp". Thedefault is the FQDN of the machine running fetchmail. The default user is the current local user. A value of -1 disablesthis option.

For the command-line option, the list values shouldbe comma-separated. Toavoid losing mail, use this option only with MDAs like maildrop orMTAs like sendmail that return a nonzero status on disk-full and otherresource-exhaustion errors; the nonzero status tells fetchmail thatdelivery failed and prevents the message from being deleted off theserver.

If fetchmail is running as root, it sets its user id tothat of the target user while delivering mail through an MDA. Also, do not try to combine multidropmode with an MDA such as maildrop that can only accept oneaddress; you will lose mail.

A word of warning: the well-known procmail 1 package is very hard to configure properly, it has a very nasty "fallthrough to the next rule" behavior on delivery errors even temporaryones, such as out of disk space if another user's mail daemon copies themailbox around to purge old messages , so your mail will end up in thewrong mailbox sooner or later.

The proper procmail configuration isoutside the scope of this document though. Using maildrop 1 is usually much easier, and many users find the filter syntax used bymaildrop easier to understand. A servicehost and port must be explicitly specified on each host in thesmtphost hunt list see above if this option is selected; the defaultport 25 will in accordance with RFC not be accepted.

An argument of '-' causes the mailto be written to standard output. Messages largerthan this size will not be fetched and will be left on the server inforeground sessions, the progress messages will note that they are"oversized". An explicit --limit of 0 overrides any limits set in yourrun control file.

This option is intended for those needing tostrictly control fetch time due to expensive and variable phone rates. Combined with --limitflush, it can be used to delete oversizedmessages waiting on a server. In daemon mode, oversize notificationsare mailed to the calling user see the --warnings option. When you call fetchmail with a 'limit' option in daemon mode, this controls the interval atwhich warnings about oversized messages are mailed to the calling user or the user specified by the 'postmaster' option.

One suchnotification is always mailed at the end of the the first poll thatthe oversized message is detected. Thereafter, re-notification issuppressed until after the warning interval elapses it will takeplace at the end of the first following poll.

An explicit --batchlimit of 0overrides any limits set in your run control file. While sendmail 8 normally initiates delivery of a message immediatelyafter receiving the message terminator, some SMTP listeners are not soprompt. MTAs like smail 8 may wait till thedelivery socket is shut down to deliver.

This may produce annoyingdelays when fetchmail is processing very large batches. Settingthe batch limit to some nonzero size will prevent these delays. By default there is no limit. An explicit --fetchlimit of 0overrides any limits set in your run control file. This option is useful in reducing the delay indownloading the first mail when there are too many mails in themailbox. By default, the limit is If set to 0, sizes of allmessages are downloaded at the start. For POP3, the only validnon-zero value is 1.

Binarysearch avoids downloading the UIDs of all mails. This saves time especially in daemon mode where downloading the same set of UIDs ineach poll is a waste of bandwidth.

The number 'n' indicates how rarelya linear search should be done. In daemon mode, linear search is usedonce followed by binary searches in 'n-1' polls if 'n' is greater than1; binary search is always used if 'n' is 1; linear search is alwaysused if 'n' is 0.

In non-daemon mode, binary search is used if 'n' is1; otherwise linear search is used. The default value of 'n' is 4. This option works with POP3 only. This is a gooddefense against line drops on POP3 servers.

This is safest when yourconnection to the server is flaky and expensive, as it avoidsresending duplicate mail after a line hit. However, on largemailboxes the overhead of re-indexing after every message can slam theserver pretty hard, so if your connection is reliable it is good to doexpunges less frequently. Also note that some servers enforce a delayof a few seconds after each quit, so fetchmail may not be able to getback in immediately after an expunge -- you may see "lock busy" errorsif this happens.

If you specify this option to an integer N,it tells fetchmail to only issue expunges on every Nth delete. An argument of zerosuppresses expunges entirely so no expunges at all will be done untilthe end of run. The appropriate user identification is both server and user-dependent. Direct SMTP mail feeds work well where systems have a permanent network connection and are powered up all the time, as is usually the case in academic institutions and commercial environments, as they will be able to receive incoming mail at any time.

But the growth in popularity of the Internet in the mid's amongst home computer users - the vast majority of whom were using Windows PCs and Macintoshes which do not support incoming SMTP mail - to access the 'Net using dial-up modems inspired the development of alternative mail delivery protocols where instead of having mail pushed to them at any time of day or night, users could instead elect to store their mail on a designated mail server and pull it down at a time when it suited them.

One such protocol is POP Post Office Protocol , so named because it works in much the same way as a rural postal service; in many remote country districts, there are no postmen to bring your mail to your doorstep and you need to visit the local post office every so often to collect your mail.

Another protocol is IMAP, a more powerful protocol that can be used for things other than mail. This caused a problem for these users as most UNIX mail software relies on mail being delivered to a local mail spool. However, some of the functionality of mail clients like pine, elm and mutt is lost when using POP or IMAP; pine for example sets flags to indicate the status of a message - whether it is new, answered, awaiting deletion, etc - and it does this by inserting the flags into the message within the SMTP mail spool file.

Entries for new servers begin with the word poll. You can specify server entries with the work skip and cause fetchmail to ignore these entries unless they are specified on the command line. This skip functionality is intended make it easy to disable checking mail servers that have gone off line or for testing purposes. Once the. When invoked from the command line, fetchmail will poll all of the configured servers from the. If fetchmail is running as the root user, it will drop privileges to deliver messages to specific user accounts.

When fetchmail has completed this process it will quit until it is invoked again. If you want fetchmail to run as a daemon process, consider using the daemon option, either by specifying a global option as described below or by specifying the -d option on the command line. For example:. In the above example, fetchmail will poll mail sources for new mail every seconds, or once every five minutes.

These allow you to configure the behavior of fetchmail with regards to all of the servers that it polls. These options are included at the beginning of the file and begin with the word set. Here is an example:. The daemon setting with an interval specification in seconds, will cause fetchmail to daemonize itself and run as a background service. In this mode, each mail server will be polled on the interval specified. Consider the following excerpt:. In this example the daemon is set to run every 60 seconds.

Fetchmail is set to poll the example. At the same time, the example. The set postmaster option allows you to configure where otherwise undeliverable will be delivered. Given the following example:.



0コメント

  • 1000 / 1000