Note: fetchmail is fine, but, if possible, we recommend people use a POP/IMAP capable mail client, and connect directly to the mail server, as shown above.
In some instances, people want to use a non-POP/non-IMAP mail application, but still want to read their mail locally, even if their workstation is not a mail server. fetchmail is used to connect to a remote mail server, and bring your email to your local mailbox. You then may use your favourite mail client to browse through your mail.
As with using the POP/IMAP protocols to read your email off a remote server, fetchmail will need to be configure so it is tunneled through SSH.
This is done by first enabling the SSH-tunnel, then using fetchmail to use that tunnel to access mail on the remote server.
Two ways will be shown here. Both will use the .fetchmailrc configuration file to perform the SSH-tunneling of the protocol desired. The first method is simpler while the second one more graceful and more permanent.
In both cases, the configuration file, .fetchmailrc will look similar to:
defaults
fetchall
keep
mda "/usr/bin/procmail -d %T"
poll mail_server.inst.nrc.ca via localhost port l_port with proto protocol:
preconnect "ssh -f -L l_port:mail_server.inst.nrc.ca:r_port mail_server.inst.nrc.ca sleep 20 /dev/null";
where
Permissions on .fetchmailrc should be 600 (rw----).