ABOUT SETTING UP MAIL ON PPP-CONNECTED DIAL-UP MACHINES OR WORKSTATIONS USING A CENTRAL MAIL SYSTEM. ========================================================== # This howto is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This howto is for you if you have a Unix machine that does not have a permanent Internet connection but rather uses dial-up PPP to connect to your Internet service provider. The problem also affects those using a central mail system for a workstation and want the central address to show up as the "From:" address in the header. A common problem is how to masquerade as your ISP's mailhost to get From: [email protected] instead of From: [email protected] Another problem is how to send and receive mail. 0.) Fixing MH ============= This section is probably not relevant to use of a central mail system. For PPP connections you just need to add two lines to your MH mail transport configuration file. For original MH this file is called mtstailor (typically installed in /usr/local/lib/mh). For nmh it is mts.conf (typically installed in /usr/local/nmh/etc). In either case you put in two entries: "localname" defines the machine name used in From: lines, "clientname" the machine name used in the SMTP HELO header. (If you don't put a clientname entry then localname gets used, which may make your SMTP server unhappy if it tries to verify HELO.) For example, I have: localname: sss.pgh.pa.us clientname: sss.sss.pgh.pa.us If you do step 0 then you probably do not have to setup sendmail masquerading. 1a.) Setting up sendmail for masquerading ========================================= If you don't use sendmail or Postfix, you're on your own. (See 1b if you use Postfix.) If you're using sendmail, all you need to do is to replace your /etc/sendmail.cf with a new sendmail.cf that you generate using the m4 files that come with any (newer) sendmail source distribution. In that distribution you'll find directories ./cf/cf, ./cf/domain, ../cf/feature, ... You first have to create an m4 config file for your host. The file ./cf/README explains how to do that. If you don't want to read it, here is a quick start with an m4 config file (myhost.mc) that should be appropriate in most cases (if you don't use procmail, delete the lines regarding procmail; BTW, redhat 4.2 uses procmail): # myhost.mc VERSIONID(`Put here some free text describing the version of this config file') OSTYPE(linux) DOMAIN(generic) define(`SMART_HOST', `myispmailhost.com')dnl FEATURE(masquerade_envelope) MASQUERADE_AS(myispdomain) define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl define(`confCOPY_ERRORS_TO',`mylocalloginname')dnl FEATURE(nouucp) FEATURE(local_procmail) MAILER(local) MAILER(smtp) MAILER(procmail) In many cases, myispmailhost.com and myispdomain are the same: Myispmailhost is the host that accepts SMTP connections on TCP port 25 and acts as a mail relay to the outer world (smart host). Very often the name of a PPP connected machine does not have a valid entry in DNS (domain name service), i.e. other machines that try to determine your IP address using your hostname will get an error. Some domains (notably AOL) won't accept mail from your host if they get such an error. Therefore, you need to use a mail relay since otherwise you won't be able to send mail to such domains. If you did not get the address of a mail relay from your ISP provider, the best bet is to use the same host that you were told to use as your POP server. Myispdomain is what you want to see in your "From:" lines. For example, if you choose MASQUERADE_AS(isp.nowhere.com) your "From:" lines will appear as From: [email protected] although the name of your PPP connected Unix machine is completely different. After editing myhost.mc, put the file into ./cf/cf. Then cd to ./cf, call m4 m4/cf.m4 cf/myhost.mc > sendmail.cf su cp sendmail.cf /etc touch /etc/sendmail.cw and restart sendmail. That's all. 1b.) Setting up postfix for masquerading ======================================== You will need to edit the postfix main.cf file often found in /usr/local/etc/postfix. No other file needs adjustment. In the section titles "ADDRESS REWRITING", add the lines: masquerade_domains = $mydomain masquerade_exceptions = root,mailer-daemon You may add any other accounts for which you do not want masquerading to querade_exceptions. Normally you will not want to set both mail_origin and masquerade_domains as they will be processed sequntially and masquerade_exceptions will be lost. You can find more information on these changes in sample-rewrite.cf. 2.) Setting up fetchmail ======================== Fetchmail is very good at downloading mail from your mailbox at your ISP using POP3 (post office protocol version 3). First get and install fetchmail (for example, from any sunsite mirror). Configuring fetchmail means basically editing a file ~/.fetchmailrc. Here is my ~/.fetchmailrc: ------------------------------------------------------------------- poll sirius.physik.TU-Berlin.DE protocol pop3: user henrik there has password ********, is henrik here; ------------------------------------------------------------------- Replace "sirius..." with the name of your POP server (your ISP should have told you which server to use). Of course, you have to change the login names and the password. Don't forget to set the file permissions to 600 using "chmod 600 ~/.fetchmailrc" (otherwise other users can read your password). 3.) Automatically sending the sendmail queue and fetching mail at dial-up ======================================================================== If you're sending mail while not being connected to the Internet, sendmail will append this mail to the mail queue. To automatically send all mail in the queue whenever you connect to the net using PPP, add this line to your /etc/ppp/ip-up: PATH=$PATH:/usr/sbin:/sbin export PATH sendmail -q You probably want to fetch all your new mail whenever you connect, so add this to /etc/ppp/ip-up (will fetch your mail on startup and afterwards in intervals of 300 seconds): su -c 'fetchmail --daemon 300 --syslog;' henrik (replace "henrik" with your local login name) and add this to /etc/ppp/ip-down to automatically kill the fetchmail daemon when you disconnect: PATH=$PATH:/usr/sbin:/sbin export PATH su -c "fetchmail --quit" henrik That's all. --------------------------------------------------------------------- Henrik Seidel, http://satchmo.physik.tu-berlin.de/~henrik/ TU Berlin, Inst. f. Theor. Physik, Sekr. PN 7-1, Hardenbergstr. 36 10623 Berlin, GERMANY, tel: +49-30-314-23000 fax: +49-30-314-21130 use "finger [email protected]" to get my public pgp key ---------------------------------------------------------------------