Fetchmail: Difference between revisions
| (8 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:How_To]] | [[Category:How_To]] | ||
==INTRODUCTION== | ==INTRODUCTION== | ||
[[File:Fetchmail.png|350px]] | |||
Fetchmail is a full-featured IMAP and POP client which allows users to automatically download mail from remote IMAP and POP servers and save it into local mailboxes; there it can be accessed more easily. Fetchmail can be installed using the mail/fetchmail port, and offers various features, some of which include: | Fetchmail is a full-featured IMAP and POP client which allows users to automatically download mail from remote IMAP and POP servers and save it into local mailboxes; there it can be accessed more easily. Fetchmail can be installed using the mail/fetchmail port, and offers various features, some of which include: | ||
| Line 17: | Line 19: | ||
It has two fundamental modes of operation for each user account from which it retrieves mail: singledrop- and multidrop-mode. | It has two fundamental modes of operation for each user account from which it retrieves mail: singledrop- and multidrop-mode. | ||
[[File: | |||
[[File:Ftc.png|300px]] | |||
==In singledrop-mode== | ==In singledrop-mode== | ||
fetchmail assumes that all messages in the user’s account (mailbox) are intended for a single recipient. The identity of the recipient will either default to the local user currently executing fetchmail, or will need to be explicitly specified in the configuration file. | fetchmail assumes that all messages in the user’s account (mailbox) are intended for a single recipient. The identity of the recipient will either default to the local user currently executing fetchmail, or will need to be explicitly specified in the configuration file. | ||
fetchmail uses singledrop-mode when the fetchmailrc configuration contains at most a single local user specification for a given server account. | fetchmail uses singledrop-mode when the fetchmailrc configuration contains at most a single local user specification for a given server account. | ||
==In multidrop-mode== | ==In multidrop-mode== | ||
Latest revision as of 11:11, 9 August 2012
INTRODUCTION[edit]
Fetchmail is a full-featured IMAP and POP client which allows users to automatically download mail from remote IMAP and POP servers and save it into local mailboxes; there it can be accessed more easily. Fetchmail can be installed using the mail/fetchmail port, and offers various features, some of which include:
Support of POP3, APOP, KPOP, IMAP, ETRN and ODMR protocols.
Ability to forward mail using SMTP, which allows filtering, forwarding, and aliasing to function normally.
May be run in daemon mode to check periodically for new messages.
Can retrieve multiple mailboxes and forward them based on configuration, to different local users.
The fetchmail utility requires a configuration file known as .fetchmailrc, in order to run correctly. This file includes server information as well as login credentials. Due to the sensitive nature of the contents of this file, it is advisable to make it readable only by the owner, with the following command:
chmod 600 .fetchmailrc
It has two fundamental modes of operation for each user account from which it retrieves mail: singledrop- and multidrop-mode.
In singledrop-mode[edit]
fetchmail assumes that all messages in the user’s account (mailbox) are intended for a single recipient. The identity of the recipient will either default to the local user currently executing fetchmail, or will need to be explicitly specified in the configuration file. fetchmail uses singledrop-mode when the fetchmailrc configuration contains at most a single local user specification for a given server account.
In multidrop-mode[edit]
fetchmail assumes that the mail server account actually contains mail intended for any number of different recipients. Therefore, fetchmail must attempt to deduce the proper "envelope recipient" from the mail headers of each message. In this mode of operation, fetchmail almost resembles a mail transfer agent (MTA). Note that neither the POP nor IMAP protocols were intended for use in this fashion, and hence envelope information is often not directly available. The ISP must stores the envelope information in some message header and. The ISP must also store one copy of the message per recipient. If either of the conditions is not fulfilled, this process is unreliable, because fetchmail must then resort to guessing the true envelope recipient(s) of a message. This usually fails for mailing list messages and Bcc:d mail, or mail for multiple recipients in your domain. fetchmail uses multidrop-mode when more than one local user and/or a wildcard is specified for a particular server account in the configuration file.
INSTALLATION[edit]
yum install fetchmail
Configure fetchmail[edit]
There are two ways of configuring fetchmail. We can make it run as a daemon with a global configuration file, or we can create a cron job to run fetchmail together with per-user configuration files.We use cron job to run fetchmail which is described below.
Let's assume Raunaq has two email accounts from which we want to retrieve emails.
The fetchmail utility requires a configuration file known as .fetchmailrc, in order to run correctly. This file includes server information as well as login credentials. Due to the sensitive nature of the contents of this file, it is advisable to make it readable only by the owner, with the following command:
vim /home/raunaq/.fetchmailrc chown raunaq:raunaq /home/raunaq/.fetchmailrc chmod 600 .fetchmailrc
create a cron job like this one (which would start fetchmail every five minutes):
*/5 * * * * /usr/bin/fetchmail &> /dev/null
Fectmailrc setting to fetch mails for a single user:
poll pop3.rahlabs.com with proto POP3 user raunaq@rahlabs.com there with password "cat_ey!@#" is "raunaq" here
Where, pop3.rahlabs.com - My POP3 server
proto POP3 – You are using POP3 protocol
raunaq@rahlabs.com - POP3 username
"cat_ey!@#" - POP3 password
"raunaq" - Local mailbox name
Fetchmailrc setting to fetch mail for multiple users:
defaults no dns envelope Delivered-To: set postmaster "allpowerfulladmin" poll mail.rahlabs.com localdomains yourlocaldomain.com proto pop3 user "username" pass "pass" to * fetchall