This brief article explains how to set up sendmail via a temporary connection. Please note that this document is provided without any guarantees whatsoever and has not been officially sanctioned by anybody... if you follow the instructions and manage to break something we will not be held responsible... at all. You bear all security risks too. Handwash only. Batteries not included.


Using sendmail on a dialup-connected machine

This article describes how to setup and use sendmail on a machine which is connected to the Internet via a dialup (SLIP or PPP) connection and which does not have a registered hostname. If you have any comments/questions/corrections please mail me. Much of the information in this article is taken from Brad Knowles' excellent sendmail FAQ, but I have embellished on some things and outlined in a step-by-step fashion what you need to use sendmail with a dialup Internet connection. The author is not a sendmail expert, but the steps outlined below have worked for him. YMMV.

Install and configure sendmail as per the instructions for your particular machine. This article convers users using both 8.6.x and 8.7.x style configuration files, so most users should be able to follow these. It is recommended that those of you using versions less than 8.7.6 upgrade to it as soon as possible as earlier versions have some serious security problems.

In this example, the person wishing to use sendmail has a real email address at his ISP of mjturner@hendrix.org, but his or her machine at home has a fake address of dogbert.fakehost.com (ie no DNS entry exists for dogbert). The user's ISP's mail server is mail.hendrix.org and he or she logs in as mj at home. Note: the editing of the sendmail config files and the restarting of sendmail requires that you be root.


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.

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.

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".

    • 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
      

    • 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
      

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.

Optional: 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.


[ Home | Joining | LEG FAQ | LEG Mailing List | Documentation ]
[ Graphics | Linux ftp Sites | LEG ftp Site | Linux Links | Mirrors | Search | Mail Us ]
Written by Michael-John Turner
Last updated on Thursday, June 26 1997 at 17:51 SAT.