Next Previous Contents

4. How do I send and receive email

First of all, ensure that sendmail is installed. Sendmail sorts internal and out-bound mail, and will buffer out-bound mail until such time it is possible to forward it.

Sendmail is based on a configuration found in /etc/sendmail.cf. An example suitable for ISP users can be found in:

ftp://ftp.sol.no/user/egilk/sendmail.cf This is based on procmail as a delivery agent but may easily be changed to use deliver.

It is if course required to have an official domain address for out-bound mail, something which is specified in sendmail.cf:

# who I masquerade as (null for no masquerading)
DMacme.xz
This assumes that you have the same user name locally as you have at your ISP. If it is different, just specify the full name instead:
DMdick@acme.xz
Sendmail is now configured for sending directly to the recipient. To avoid long and repeated connections in those cases where the connection to the receiving end is slow and irregular, is is usually nice to use ones ISP as a buffer store. This can be specified by the DS specification:
# "Smart" relay host (may be null)
DSmail.acme.xz
Beware that sendmail is somewhat sensitive to handling of tab stop characters in sendmail.cf. You might want to use the vi editor to ensure that these tab characters are retained unchanged.

Email reception can often be performed via the POP3 protocol, which can be initiated every time the connection is brought up. A script for testing this is:

sendmail -q
popclient -3 -v mail.acme.xz -u dirk -p "PrettySecret" \
       -k -o /usr/spool/mail/dirk
This script may be started after PPP connection has been established. Beware that this script is just for testing, so ensure that the local mailbox is left untouched while it runs. The -k option means that the mail is kept in the ISP mailbox, and you are simply given a copy of the mail. You would of course want to remove this option once you are confident that your setup is working.

Beware that the password will show on the command line. Also note that popclient is getting old fashioned, and that you should consider using fetchmail instead.

A more secure and better version of this script may be found at:

ftp://ftp.sol.no/user/egilk/pop-script.tar.gz

This version of the script requires that procmail is installed, but that is something you'll never regret anyway. Most distributions include it, otherwise you may try:

ftp://sunsite.unc.edu/pub/Linux/system/Mail/mailhandlers/procmail-3.10-2.tar.gz

Procmail is a simple and flexible tool that can sort incoming email based on a large range of criteria. In addition to being able to handle automated tasks like vacation messages and such.

Note that when we use procmail directly as in this case, the situation is somewhat different from what is described in the procmail documentation. A .forward is not required, and we also don't need a .procmailrc. The latter is only required if we want to sort the mail.

The user interface for reading and sending of email can be found in programs like pine or elm.

ALT: Fetchmail has recently become an improved alternative to popclient. The latest version is available from:

ftp://ftp.ccil.org/pub/esr/fetchmail/fetchmail-3.3.tar.gz

ALT: For an ordinary dial-up ISP user it is not really necessary to have the sendmail daemon active. To reduce resource usage, and possibly other problems, one may thus comment out any startup of sendmail, as is usually found in /etc/rc.d/rc.M (this varies from distribution to distribution).

ALT: In place of sendmail one might use the simpler smail. You'll find a good description of it (as well as most other things mentioned here) in the Linux Network Administrator's Guide.

ALT: There is also an m4 macro package for making a fresh /etc/sendmail.cf. For a simple installation it might be just as well to modify an existing configuration.

ALT: There are also simpler although less flexible alternatives for handling email. Pine may run stand-alone as long as it is configured properly, for instance. It might even be possible to use newer versions of some web-browsers.

ALT: Many are very enthusiastic regarding the Emacs companion Gnus as an email and news handler. Further information can be found at:

http://www.ifi.uio.no/~larsi/

ALT: An alternative to popclient is pop-perl5. It is available from:

ftp://sunsite.unc.edu/pub/Linux/System/Mail/pop-perl5-1.1.tar.gz


Next Previous Contents

mirror server hosted at Truenetwork, Russian Federation.