# 7.7. How do I set up sendmail to work with Kmail if I have a dial-up connection?

These instructions were taken almost verbatim from the UCT Linux User's group page on configuring Sendmail for Dial-up connections.

## 7.7.1. Step 1: Masquerade host

You now need to edit `/etc/sendmail.cf` to tell it which host to masquerade as. Look for a line which says something like:

     # who I masquerade as (null for no masquerading) (see also $=M)
     DM

and add your address to the end of the line beginning "DM". Our user changed it to the following

     DMhendrix.org

When our user sends mail, the `Return-Path` and `From:` fields will now say that the mail comes from hendrix.org. This prevents "cannot route to sender" messages which certain hosts you send mail to may generate because your machine does not have a DNS entry. We must still change the user portion of the email address, because if our user sends mail now, the `From:` field will read `mj@hendrix.org`, which is not correct. If you login to your home machine with the same username as the username portion of your email address, you can skip ahead to restarting sendmail. If you have different usernames (as our example does), you need to add a user database.

## 7.7.2. Step 2: Create a user database

Create a file modelled on the following:

     loginname:mailname      First_Last
     First_Last:maildrop     loginname

"loginname" is the name you login is on your machine at home (in this case mj), "First_Last" is the name portion of your email address (in this case mjturner). In this case our user created a file called `/etc/userdb` containing the following:

     mj:mailname     mjturner@hendrix.org
     mjturner:maildrop       mj

Once you have done this, you need to convert the text file `/etc/userdb` into a Berkeley "db" database file which sendmail can understand. To do this, you need to run makemap as follows:

     # makemap btree /etc/userdb.db < /etc/userdb

This creates the database file `/etc/userdb.db` from the text file `/etc/userdb`. You must remember do this every time you change `/etc/userdb` otherwise sendmail will not be using your latest user database when sending mail.

## 7.7.3. Step 3: Add user database to sendmail.cf

You must also tell sendmail to use your user database (`/etc/userdb.db`) when sending mail. The syntax differs slightly depending on whether you are using an 8.7.x/8.8.x or 8.6.x config file. You can tell which version yours is by searching for the string "DZ" (`grep ˆDZ /etc/sendmail.cf`). For example, an 8.8.0 config file would say `DZ8.8.0`.

### 7.7.3.1. 8.6.x config file

If you are using an 8.6.x config file, look for a line beginning

         # list of locations of user database file (null means no lookup)
         OU

and add the location of your user database. Our user changed the above line to:

         OU/etc/userdb.db

### 7.7.3.2. 8.7.x or 8.8.x config file

If you are using an 8.7.x or 8.8.x config file look for a line beginning

         # list of locations of user database file (null means no lookup)
         O UserDatabaseSpec=

and add the location of your user database to it. Our user changed it to the following:

         O UserDatabaseSpec=/etc/userdb.db

## 7.7.4. Step 4: Restart sendmail

After making these changes, as root you need to restart sendmail:

     # ps aux | grep sendmail | grep -v grep
     root        64  0.0  0.0  1208     0  ?  SW  11:45   0:00 (sendmail)

     # kill -HUP 64

(use `ps -ef` instead of `ps aux` if you're using SysV).

Sendmail will now re-read its config file (`/etc/sendmail.cf`) and everything should be working. When you send mail, the from header field will be a valid email address and not the address you have on your machine. For example, when our user sends mail, it will read `From: mjturner@hendrix.org` in the headers. This works with all mail user agents (Mutt, Elm, Pine, mh, etc) because the address translation is done at the mail transport agent level. Basically, you can use any program to send mail and your address will be correct.

## 7.7.5. Step 5: Configure a "smart" relay

It can take quite a while for mail to get delivered to its final destination, as sendmail has to connect to the mail servers of the recipients of your mail. This time would have to be spent online, something which can prove to be costly. If, however, you configure sendmail to use a "smart" relay, it will deliver all mail to that relay and the relay will then deliver it to its destination. Your ISP's mail server makes an ideal "smart" relay.

Change

     # "Smart" relay host (may be null)
     DS

to

     # "Smart" relay host (may be null)
     DSmail.hendrix.org

Don't forget to restart sendmail after doing this (see restarting sendmail). All non-local mail will now be sent to `mail.hendrix.org` which will then deliver it to its final destination.