Section 9.4. I Can t Send out Email Because the ISP s Server Is Down


9.4. I Can't Send out Email Because the ISP's Server Is Down

Despite the reliability of Linux, everyone experiences downtime, even your ISP. Power failures can outlast available battery backups. Surges and kernel upgrades can force reboots. And many ISPs rely on Microsoft Windows. Your network may still be working, but your ISP's email servers might go down.

If you work from an Internet café, you may not be able to send email through your ISP's mail server. Many of those servers aren't accessible from outside their networks. While you can use a web-based email interface, that interface can't download directly to an email manager such as Novell Evolution or KMail.

In this situation, there are two basic options:

  • Route your email through a different ISP.

  • Create your own email server.

This annoyance explores each of those solutions.

9.4.1. Route Email Through a Different ISP

If you don't want to configure an email server on your network, the simplest option is to route your email through a different ISP, such as one associated with your personal web site. In fact, this is what I do because large-scale MTA programs such as sendmail and Postfix make little sense for my home network.

If your alternate ISP supports outgoing email, they'll have an email server with a URL such as mail.otherisp.net, which you can use in the account information for your email manager.

You may have a backup ISP for emails and not even realize it. If you run your own web site, the ISP with the web server usually provides free email addresses. They'll have incoming and outgoing mail servers for those accounts. While regulations vary by ISP, yours may allow you to use their outgoing email servers for any email account.

If you have an email address on a different domain from your ISP, with POP3/IMAP4 support, you may have another option. POP3/IMAP4 support requires incoming and outgoing email servers. Once you find the third-party domain URL for the outgoing email server, you can substitute that account information in your email manager.

As I've configured my primary emails through my personal domain name, I can send and receive emails even when my primary ISP goes down. All I need to do is connect at a nearby Internet cafe, or use my neighbor's wireless network (with permission). It doesn't matter what domain is associated with my email address.

9.4.2. Create Your Own Email Server

If your ISP's outgoing email server goes down, you have another option: you can set up your own email server. Because the default settings associated with the sendmail, Exim, and Postfix services are acceptable for small-scale uses, the process is simple.

Despite their popularity, I do not cover any of these services in detail. One excellent book on sendmail is sendmail by Bryan Costales and Eric Allman (O'Reilly). (It's over 1,200 pages long.) For more information on Exim, see http://www.exim.org, and for more information on Postfix, see http://www.postfix.org.

There are two basic versions of the sendmail email server. More information on the open source version of sendmail is available from http://www.sendmail.org. There is also a closely related commercial version, known as Sendmail; more information is available from http://www.sendmail.com.


For the purpose of this annoyance, I'll show you how to configure sendmail on Red Hat Enterprise Linux 4, Postfix on SUSE 9.3, and Exim on Debian Sarge. Naturally, the steps you take to configure one server on one distribution generally apply to the other distributions as well, with small changes such as directory locations.

If you have a dial-up connection to the Internet, it's generally best to use the mail server provided by your ISP. Otherwise, when a user sends email, she may believe that it's sent, when in fact it is stuck waiting for your modem to make a connection.


Once you configure an outgoing email server, you'll want to make sure that the email clients on your network point to that server. That process varies by client and is an elementary part of the configuration process for a client such as Evolution, Thunderbird, or Kmail.

9.4.2.1. Configuring outgoing sendmail on Red Hat

When you configure sendmail from a Red Hat or Fedora package, you're configuring the open source version of sendmail, as opposed to the commercial version of Sendmail.

When you install the sendmail RPM package, you'll find a series of configuration files in the /etc/mail directory. Some are macro files with an .mc extension, which are generally all you need to edit. Once editing is complete, you can then process the .mc macro files into the actual sendmail configuration files.

When editing a sendmail macro file, you need to be aware of two conventions:

  • The way directives are set is unusual; the quotes you see start with a backtick or back quote (`), which is above the Tab key on most U.S. keyboards, and end with a standard single quote (').

  • The comment code associated with a sendmail macro file is dnl. Any line that starts with this code is ignored by the m4 processor, which creates the sendmail configuration file from the macro file.

The sendmail configuration file, sendmail.cf, includes a couple of thousand lines. It's easier to configure the sendmail macro file, sendmail.mc, which is then processed by the m4 macro processor. See the comments in sendmail.mc or sendmail by Bryan Costales and Eric Allman (O'Reilly) for more information.


In the default versions of the sendmail configuration files from the Red Hat/Fedora package, you need to change one line in sendmail.mc. The following directive in the default version of the file limits access to the local computer:

 DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA') 

Naturally, this won't help you if you're configuring sendmail for other computers on your network. The easiest solution is to disable this directive by adding a dnl in front.

Now you can enable sendmail with the following commands, and then point the email clients such as Evolution, Thunderbird, pine, and KMail to the sendmail server host:

 chkconfig sendmail on service sendmail restart 

9.4.2.2. Configuring outgoing Postfix on SUSE

The default mail server on SUSE Linux is Postfix, which you can configure either through YaST or directly through the /etc/postfix/main.cf configuration file. The key directives are:


myhostname

Set this to the FQDN of the local system that you're using as a Postfix serverfor instance:

 myhostname = suse.example.com 


mydomain

This is the domain of the local network, such as example.com. If this is not set, it is by default set to myhostname minus the actual hostname of the local computer.


inet_interfaces

This is set to localhost by default. If you want to use your server as an outgoing email server for your network, you'll need to change this to all, as follows:

 inet_interfaces = all 


mynetworks

This limits access to a desired network, such as your LAN. For example, you can limit email users to the local computer and network with the following directive:

 mynetworks = 192.168.2.0/24, 127.0.0.0/8 

You can also configure Postfix using YaST. If you do, inspect the results in the /etc/postfix/main.cf file. Despite the quality of YaST, no GUI tool is infallible. If it doesn't include the directives as shown here, you'll have problems and will want to try again.

9.4.2.3. Configuring outgoing Exim on Debian

When you install many Debian packages with the apt-get command, you'll get an opportunity to configure it right away. For example, to install the packages required for the Exim email server, you can run the following command:

 apt-get install exim4-config 

This installs the required packages, including exim4, exim4-config, exim4-base, exim4-daemon-light, mailx, and qpopper. When you run the command shown above, you're prompted to configure the mail server. Once the process starts, follow these steps:

  1. When you're prompted for the domain for which exim4 should administer email, enter the domain for your LAN, such as example.com.

  2. If you ever need to restart the configuration process, you don't need to reinstall Exim; just run the following command:

     dpkg-reconfigure exim4-config 

  3. The first choice you make is whether to split the configuration into small files in the /etc/exim4/conf.d directory. Unless you know what you're doing, select No. The process continues, and you can configure /etc/exim4/exim4.conf.

  4. Select one of the following six ways to configure Exim:


    Internet site; mail is sent and received directly using SMTP

    Suitable for receiving mail from other hosts on a LAN, as well as sending mail to outside networks. Requires a static IP address. The actual server used still depends on the email client.


    Mail sent by smarthost; received via SMTP or fetchmail

    Allows sending and receipt of email via Exim; suitable if your IP address is dynamically assigned by your ISP.


    Mail sent by smarthost; no local mail

    While you might think this prohibits email on the LAN, that's not quite true; for more information, see Debian bug report 297841.


    Local delivery only; not on a network

    Mail is delivered by Exim only to users on the LAN.


    Manually convert from handcrafted Exim v3 configuration

    If you have an existing Exim 3 server and have upgraded to Exim 4, this option suggests that you use the exim_convert4r4 tool to convert your configuration files.


    No configuration at this time

    No further configuration is done, and the utility stops.

  5. Now you can set the "System mail name," which corresponds to the hostname of the email server. The default is the current hostname.

  6. Set the IP addresses governed by this Exim server. Unless you're running an ISP, you'll want to limit it to your LAN; for example, if your LAN uses the 192.168.0.0 class C network address, enter:

     127.0.0.1 : 192.168.0.0/24 

  7. If you're using Exim for incoming email, select the domain for which your network is the final destination, such as example.com.

  8. Now if you're configuring Exim for other domains, you can relay mail for them. You can enter their domain names, separated by colons, in the "Domains to relay mail for" field.

  9. If you've configured Exim for other domains, you'll get a chance to enter their IP network addresses in the same CIDR format as in step 5; multiple networks can also be separated by colons.

  10. If your system connects to the Internet through a dial-up connection, you'll want to keep DNS queries to a minimum by answering Yes at a prompt. Otherwise, select No.

  11. This tool now writes your configuration file to /etc/exim4/update-exim4.conf.conf and restarts the exim4 service.

  12. Run the update-exim4.conf tool. This processes the configuration file created in the previous step with Exim defaults, and writes the result to /var/lib/exim4/config.autogenerated.

  13. Restart the Exim4 daemon with the following command:

     /etc/init.d/exim4 restart 



Linux Annoyances for Geeks
Linux Annoyances for Geeks: Getting the Most Flexible System in the World Just the Way You Want It
ISBN: 0596008015
EAN: 2147483647
Year: 2004
Pages: 144
Authors: Michael Jang

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net