Setting Up E-mail

This article gives step-by-step instructions to set up your e-mail configuration properly and an overview of various pieces of e-mail software.

In my time on IRC (Internet Relay Chat), I found that the number one problem newbies have, after setting up PPP, is e-mail setup. Many people get their e-mail half-working and leave it at that, for fear of breaking it and not knowing how to fix it.

Mail handling is split up between several types of programs, instead of having everything handled by a single program (such as Eudora). Trust me, it is conceptually easy, and once you understand it, very quick and easy to set up. It also gives you a lot of flexibility.

I've included three sidebars which you may wish to read first; in particular, the Glossary for definitions of terms I will be using. Although there are alternative programs, I'll discuss the ones that I use.

Glossary

Prerequisites

First, you need to get an e-mail account set up by your ISP with mail delivered to their machine. Then, you need to know your ISP's domain and your password on the mail server (usually the same as the password you use when you start up PPP). For the examples in this article, we will call the ISP domain foo.com, the user name barney and the password f00bar.

To begin, you need the following programs or their alternatives:

  • pine [or elm]

  • either smail or sendmail

  • fetchpop [or fetchmail]

  • procmail

To find out if these programs are installed on your system, use the command which. If you type which program at the prompt, the pathname of that program, if it exists in your path, will be returned to the screen. For example, which might return the path /usr/bin/program, letting you know that program is in the /usr/bin/ directory. All of the basic distributions (Slackware, Debian and Red Hat) usually include all of these programs except fetchpop, so you should have no problem finding and installing them.

fetchpop sources can be downloaded from http://snakepit.wasteland.org/fetchpop.tgz (special thanks to TheAsp for hosting this prepatched version on his server so downloading it from Sunsite is unnecessary).

Pine

For this example, Pine is your MUA (mail user agent). You use it to read and write mail. Start up pine by typing pine at the prompt. When you see the opening screen, type s to call up the setup menu, then type c to go to the configuration screen. Now do the following steps.

  1. Press enter and type in the personal name you wish to be associated with your actual e-mail address. Mixed case and spaces are allowed (e.g., Barney Fallon). In this case, other people will see your address as Barney Fallon (barney@foo.com).

  2. Set smtp-server to localhost to ensure that mail gets handed to your local MTA (mail transport agent), where you don't have to worry about it. The MTA then sends it off the next time you connect. (See Glossary and Generic Mail Flow sidebars.)

  3. Leave the other options set to the defaults for now.

To send mail from the prompt or in a script, type:

pine person@address.com < message.file
Smail/Sendmail

Use smail or sendmail as the MTA (mail transport agent). You use it to transport mail between machines. People have written 600 page books on setting up these programs. The horror stories are numerous. For this simple application, in most cases, you don't have to do any set up. If you use Slackware, Debian or Red Hat, the default setups for smail and sendmail work fine right out of the box.

Some installation scripts may ask you whether to use a smarthost, which means it will hand mail to your ISP's mail server so it can do the delivery. That decision is up to you. There's not much difference. If you plan to receive mail on your machine, you might want to look at the /etc/aliases file some day.

If your user name at your ISP is barney@foo.com and you wish this name to show up in the From: header, use sendmail to handle it by taking the following steps:

  1. Create a user named barney on your system.

  2. Edit the /etc/sendmail.cf file line that begins with the characters #DM by changing it to masquerade the Domain (DM—Domain Masquerade), e.g., DMfoo.com. If your machine has a hostname, but not a domain name (i.e., it is not networked except via your ISP), you may also need to edit the line #Dj$w.Foo.COM to remove the # and change Foo.COM to your ISP's domain name. Finally, edit the DS line to name the Domain Smart mail host, if you wish your ISP to actually forward all your mail.

  3. Once the changes are made and saved, just execute SIGHUP<\!s>sendmail, so sendmail will re-read the sendmail.cf file.

Sometimes smail or sendmail will die. You will then get a pine error message saying the SMTP connection is not available . If this occurs, log in as root and type smail -bd or sendmail -bd. If this type of failure happens consistently, the first thing to check is your /etc/rc* directories to be sure that your SMTP server is started at boot up.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

smarthost with authentication

Jacques's picture

Hi,
Thanks for the info on smail with all the various configuration options.

In my case, my ISP doesn't provide SMTP functionality and I have to route mail through my mail hosting provider's SMTP server. But in order to do this, it needs to authenticate, since I'm not connecting from the same IP range and it would generally be regarded as an open relay if they were to allow it.

Is there any way I can set up the smarthost to authenticate on the destination SMTP relay?

I don't want to send the mail directly over the net, because then the reverse lookup fails for the domain and the mail is often classified as spam.

Hope someone can assist

Jacques

Re: Linux Apprentice: Setting Up E-mail

Anonymous's picture

Problem in Running Sendmail server ??what all issue i need to address....?

regards,

anurag

reachanurag@hotmail.com

Re: Linux Apprentice: Setting Up E-mail

Anonymous's picture

Hi

This is Eric, can you be a bit more specfic at your
problem.
Do you have problem with the S80 send mail program ?

Fun Lover,
Eric