33.3. Adding a New Mail Server to Check

Before Fetchmail will download email from a mail server for you, an entry for it must be added to its configuration. To do this, follow these steps:

1.
On the module's main page, click on the Add a new server link below the table of existing servers. If you are managing multiple users' configurations, you must use the link in the section for the user to whose list you want to add the server.

The Add Fetchmail server for user button can also be used to add a server to the user entered into the adjacent field. This method must be used if the user does not have any servers defined yet.

2.
No matter what link or button you use, the form shown in Figure 33.2 will be displayed for entering the new server's details.

Figure 33.2. The server creation form.


3.
In the Server name field, enter a unique name for this mail server entry. Typically, this will be its actual hostname, such as mail.yourisp.com.

4.
If you want this server to be checked on schedule, make sure the Polling enabled? field is set to Yes. Otherwise, it will only be checked if manually run from Webmin or at the command link.

5.
The Mail server to contact field is useful if you need to connect to more than one port or protocol on the same host. Because the Server name must be unique, you can only create two entries for the same actual mail server by entering different values for the server name (such as mail.yourisp.com-1 and mail.yourisp.com-2) and entering the actual hostname for the server into this field.

This situation is fairly rare, however, so you can usually just leave this field set to Same as server name.

6.
From the Protocol menu, select the mail retrieval protocol to use for this server. The most common are POP3 and IMAP. Your ISP or mail server administrator will be able to tell you which one to use.

7.
If the mail server is using a nonstandard port for the chosen protocol, then the Default option will not work for the Server port field. Instead, you must enter the correct port number, such as 1110.

8.
The Check condition field can be used to prevent periodic checking of this server if a network interface is down. This is useful if you have a dial-up connection to the Internet that is only active occasionally and want to avoid useless attempts to connect to the mail server when it is not active.

If Always check is chosen, Fetchmail will always try to connect. If, however, Only if interface is up is selected, no connection will be made if the network interface entered into the field next to it is down. Your primary PPP interface for dialup is normally named ppp0. See the Network Configuration module (covered in Chapter 16) for a list of active interfaces.

For checking to be performed, you must enter an interface name as well as a network and netmask to specify a range of valid local addresses for the interface. This can be useful if you dial up to several different ISPs, but only want Fetchmail to check for mail when connected to a particular one. Most ISPs assign addresses within a certain class C or B network to all customers, such as 203.51.0.0/255.255.0.0.

To allow Fetchmail to check as long as the interface is up, no matter what IP address it has, just enter 0.0.0.0 into both the network and netmask fields. This covers all possible addresses.

9.
In the Mail server user details section, enter the login name with which to connect to the mail server into the Remote user field.

10.
Enter the correct password for the user into the Remote password field.

11.
The Local user(s) field is for entering the email address to which to send retrieved messages. This is typically a local username like jcameron, but it can also be an address on another server like [email protected].

It is also possible to enter several usernames, in which case Fetchmail will attempt to work out which of those names each downloaded message is for. This is useful if you have email for several addresses forwarded to the same mailbox on your ISPs mail server and want to split up the retrieved messages for delivery to the correct local mailboxes. If Fetchmail encounters a message whose recipient is not in the list, it will be bounced back to the sender.

The final alternative is to just enter * in the Local user(s) field, which tells Fetchmail to deliver each message to the local user on your system whose name is the same as the username part of the message's destination address.

12.
If you want Fetchmail to delete messages from the mail server after downloading them, set the Leave messages on server? field to No. Unless another mail client is being used to access the mailbox, this is the best option as it prevents an additional copy of every message being stored on your ISP's server—which may have a limit on mail file sizes.

Selecting Yes causes Fetchmail to keep track of received messages and only download those in the mailbox that are new. In effect, it is synchronizing the remote mailbox to a local one, except that messages deleted on the server will not be deleted locally.

13.
If you are keeping messages on the remote server, the Always fetch all messages? field should be set to No. Otherwise, set it to Yes to guarantee that all messages in the mailbox are downloaded.

14.
The Command to run before connecting field can be used to enter a shell command that will be executed by Fetchmail just before connecting to the mail server. One of the most common uses of this feature is running a command to set up an SSH tunnel to allow access to a server that you cannot connect to directly. This can be quite complex though, and so is not covered here. Typically, this field can be left empty.

15.
Similarly, the Command to run after disconnecting field is for entering a shell command to be executed after Fetchmail logs off from the remote mail server. It is often used for killing the SSH process started by the before command.

16.
Finally, click the Create button to save the new server. It will be used hereafter whenever Fetchmail is run when it makes a periodic check.

Once you have created a new server entry, it will be listed on the module's main page. To edit it, just click on the server name in the Server to poll column, which will bring up the editing form in your browser. Change any of the fields and click Save to update the Fetchmail configuration file.

Servers can be deleted by hitting the Delete button on the editing form. It is usually better, however, to change the Polling enabled? field to No, which effectively disables the server.

Fetchmail will not connect to it unless you explicitly tell it to check that server, as explained in Section 33.4 “Downloading Email”.

It is possible to have Fetchmail check more than one mailbox on the same server and deliver mail from additional mailboxes to different users. This could be done by creating multiple configuration entries for the same server, but there is a simpler and better method, done using the following steps:

1.
On the module's main page, click on the name of the server to which you want to add an additional mailbox to check.

2.
Click on the Add another user button. The editing form will be redisplayed, but with an additional empty Mail server user details section at the bottom.

3.
Fill in the empty Remote user, Remote password, Local user(s), and other fields in the new section, as explained in the steps in Section 33.2 “The Fetchmail Mail Retrieval Module”.

4.
Hit the Save button. You will be returned to the module's main page and the new remote and local usernames will be displayed next to the server.

Even though its ability to extract mail for multiple users from a single mailbox is one of Fetchmail's most useful features, it is not 100 percent reliable. There is no way that the program can accurately determine what address an email was sent to in all cases. Normally, the To: or Cc: header will contain the destination address, but for messages received from mailing lists this is not the case—instead, the To: header contains the list's address. There are other mail headers that Fetchmail attempts to check to find the real destination address of a message, but they are not always available.

When an email message is delivered directly to a server via the SMTP protocol, the source system informs the destination server of the message's real destination address. Unfortunately, the address does not have to be in the actual message at all—instead, it is specified as part of the SMTP conversation between the servers. When the email is delivered to a mailbox, this information is lost and cannot be accurately recovered.

Only when Fetchmail is downloading email from a mailbox and delivering it to a single recipient is it guaranteed to do the right thing. In this case, it never has to check the destination address of each message because they are all being sent to a single local mailbox.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.206.223