The Linux Electronic Mail HOWTO Vince Skahan, $Id: mail-howto,v 1.8 1994/05/27 02:16:13 vince Exp vince $ This document describes the setup and care+feeding of Electronic Mail (e-mail) under Linux. You need to read this if you plan to communicate locally or to remote sites via electronic mail. You probably do *not* need to read this document if don't exchange electronic mail with other users on your system or with other sites. 1. Introduction The intent of this document is to answer some of the questions and comments that appear to meet the definition of 'frequently asked questions' about e-mail software under Linux. This document and the corresponding UUCP and News 'HOWTO' documents collectively supersede the UUCP-NEWS-MAIL-FAQ that has previously been posted to comp.os.linux.announce. 1.1. New versions of this document New versions of this document will be periodically posted to comp.os.linux.announce, comp.answers, and news.answers. They will also be added to the various anonymous ftp sites who archive such information including sunsite.unc.edu:/pub/Linux/docs/HOWTO. 1.2. Feedback I am interested in any feedback, positive or negative, regarding the content of this document via e-mail. Definitely contact me if you find errors or obvious omissions. I read, but do not necessarily respond to, all e-mail I receive. Requests for enhancements will be considered and acted upon based on that day's combination of available time, merit of the request, and daily blood pressure :-) Flames will quietly go to /dev/null so don't bother. Feedback concerning the actual format of the document should go to the HOWTO coordinator - Matt Welsh (mdw@@sunsite.unc.edu). 1.3. Copyright Information The Mail-HOWTO is copyrighted (c)1994 Vince Skahan. A verbatim copy may be reproduced or distributed in any medium physical or electronic without permission of the author. Translations are similarly permitted without express permission if it includes a notice on who translated it. Short quotes may be used without prior consent by the author. Derivative work and partial distributions of the Mail-HOWTO must be accompanied with either a verbatim copy of this file or a pointer to the verbatim copy. Commercial redistribution is allowed and encouraged; however, the author would like to be notified of any such distributions. In short, we wish to promote dissemination of this information through as many channels as possible. However, we do wish to retain copyright on the HOWTO documents, and would like to be notified of any plans to redistribute the HOWTOs. We further want that ALL information provided in the HOWTOS is disseminated. If you have questions, please contact Matt Welsh, the Linux HOWTO coordinator, at mdw@@sunsite.unc.edu, or +1 607 256 7372. 1.4. Standard Disclaimer Of course, I disavow any potential liability for the contents of this document. Use of the concepts, examples, and/or other content of this document is entirely at your own risk. 1.5. Other sources of information 1.5.1. LINUX HOWTO Documents: There is plenty of exceptional material provided in the other Linux HOWTO documents and from the Linux DOC project. In particular, you might want to take a look at the following: o the serial communications HOWTO o the ethernet HOWTO o the Linux Networking Guide 1.5.2. USENET: comp.mail.elm the ELM mail system. comp.mail.mh The Rand Message Handling system. comp.mail.mime Multipurpose Internet Mail Extensions. comp.mail.misc General discussions about computer mail. comp.mail.multi-media Multimedia Mail. comp.mail.mush The Mail User's Shell (MUSH). comp.mail.sendmail the BSD sendmail agent. comp.mail.uucp Mail in the uucp environment. 1.5.3. Mailing Lists: There is a smail-3.1 mailing list. To join (or get off) the list, send mail to smail3-users-request@@cs.athabascau.ca Make sure that you include the address at which you want to receive mail in the text of the message. To send a message to the list, send it to smail3-users@@cs.athabascau.ca. 1.5.4. Books The following is a non-inclusive set of books that will help... o "Managing UUCP and USENET" from O'Reilly and Associates is in my opinion the best book out there for figuring out the programs and protocols involved in being a USENET site. o "Unix Communications" from The Waite Group contains a nice description of all the pieces (and more) and how they fit together. o "Sendmail" from O'Reilly and Associates looks to like the definitive reference on sendmail-v8 and sendmail+IDA. It's a "must have" for anybody hoping to make sense out of sendmail without bleeding in the process. o "The Internet Complete Reference" from Osborne is a fine reference book that explains the various services available on Internet and is a great "one-stop-shopping" source for information on news, mail, and various other Internet resources. 1.6. Where *NOT* to look for help There is nothing "special" about configuring and running mail under Linux (any more). Accordingly, you almost certainly do *NOT* want to be posting generic mail-related questions to the comp.os.linux.* newsgroups. Unless your posting is truly Linux-specific (ie, "please tell me what routers are already compiled into the SLS1.03 version of smail3.1.28") you should be asking your questions in one of the newsgroups or mailing lists referenced above. Let me repeat that. There is virtually no reason to post anything mail-related in the comp.os.linux hierarchy any more. There are existing newsgroups in the comp.mail.* hierarchy to handle *ALL* your questions. IF YOU POST TO COMP.OS.LINUX.* FOR NON-LINUX-SPECIFIC QUESTIONS, YOU ARE LOOKING IN THE WRONG PLACE FOR HELP. THE ELECTRONIC MAIL EXPERTS HANG OUT IN THE PLACES INDICATED ABOVE AND GENERALLY DO NOT RUN LINUX. POSTING TO THE LINUX HIERARCHY FOR NON-LINUX-SPECIFIC QUESTIONS WASTES YOUR TIME AND EVERYBODY ELSE'S...AND IT FREQUENTLY DELAYS YOU FROM GETTING THE ANSWER TO YOUR QUESTION. 2. Hardware Requirements There are no specific hardware requirements for mail under Linux. You'll need some sort of 'transport' software to connect to remote systems, which means either tcp-ip or uucp. This could mean that you need a modem or ethernet card (depending on your setup). 3. Getting the software In general, I grab my sources from ftp.uu.net and the other fine archive sites on Internet. In addition, Linux-specific binary ports are found in the usual Linux distrbutions and on the usual Linux anonymous ftp sites (sunsite.unc.edu and tsx-11.mit.edu in particular). The newspak-2.2.tar.z distribution contains config files and readme files related to building uucp, news, and mail software under Linux from the various freely-available sources. It can usually be found on sunsite.unc.edu in the directory /pub/Linux/system/Mail. 4. Mail 'Transport Agents' This section contains information related to 'transport agents', which means the underlying software that connects your local system to remote systems. 4.1. Smail v3.1 Smail3.1 seems to be a de-facto standard transport agent for uucp-only sites and for some smtp sites. It compiles without patching from the sources. In addition, smail is provided in binary form in the SLS distribution of Linux. The newspak distribution contains config files for smail3.1.28 under Linux that you can use to start with. If you're building smail from sources, you need to have CASE_NO_NEWLINES=true in your os/linux file so that 'sed' gives you shell scripts that work properly. For a uucp-only system that has a MX-record and that wants a domainized header (who goes through a smart-host for everything), these are the entire config files you'll need: o replace 'subdomain.domain' with your domain name o replace 'myhostname' with you un-domainized hostname o replace 'my_uucp_neighbor' with the uucp name of your upstream site #-------- /usr/local/lib/smail/config ----------------- # # domains we belong to visible_domain=subdomain.domain:uucp # # who we're known as (fully-qualified-site-name) visible_name=myhostname.subdomain.domain # # who we go through smart_path=my_uucp_neighbor # #---------- /usr/local/lib/smail/paths -------------- # # we're a domainized site, make sure we accept mail to both names myhostname %s myhostname.subdomain.domain %s # #------------------------------------------------------------------- To run smail as a smtp daemon, add the following to /etc/inetd.conf: smtp stream tcp nowait root /usr/bin/smtpd smtpd Outgoing mail gets sent automatically, when using elm. If your internet link is down when you send mail, then the mail sits in "/usr/spool/smail/input". When the link next comes up, "runq" is run which causes the mail to be sent. 4.2. Sendmail+IDA I run a uucp-only site and use sendmail5.65b+IDA1.5 instead of smail3.1.28 due to the incredible ease of use. There is a binary distribution on sunsite.unc.edu in pub/Linux/system/Mail To install it... o you'll probably want to remove (or rename) all the files from smail (see the /install/installed directory if you are SLS) to be safe. o cd to / then "gunzip -c sendmail5.65b+IDA1.5.tpz | tar xvf -" If you have a "modern" tar from a recent Slackware (for example) you can probably just do a "tar -zxvf filename.tgz" and get the same results. o cd to /usr/local/lib/mail/CF and copy the sample.m4 local.m4 file to "yourhostname.m4". Edit out the distributed hostname, aliases, and smarthost and put in the correct one for your site. The default file is for a uucp-only site who has domainized headers and who talks to a smart host. Then "make yourhostname.cf" and move the resulting file to /etc/sendmail.cf o if you are uucp-only, you do *NOT* need to create any of the tables mentioned in the README.linux file. You'll just have to touch the files so that the Makefile works. Just edit the .m4 file, make sendmail.cf, and start testing it. o if you're uucp-only and you talk to sites in addition to your "smart-host", you'll need to add uucpxtable entries for each (or mail to them will also go through the smart host) and run dbm against the revised uucpxtable. o if you use my sendmail5.67b+IDA1.5 distribution you should not use a "freeze file". o If you run Rich Braun's original binary distribution of 5.67a, you'll need to freeze the configuration if you change your .cf file with "/usr/lib/sendmail -bz" to make the changes take effect. You should also update your version to at least 5.67b since there is a nasty security hole in 5.67a and earlier. Another nice thing is that if you have mail.debug set and you run syslogd, your incoming and outgoing mail messages will get logged. See the /etc/syslog.conf file for details. The sources for sendmail+IDA may be found at uxc.cso.uiuc.edu. They require no patching to run under Linux. If you're going to run sendmail+IDA, I strongly recommend you go to the sendmail5.67b+IDA1.5 version since all required Linux-specific patches are now in the vanilla sources and several security holes have been plugged that WERE (!!!) in the older version you may have grabbed or built before about December 1st, 1993. 4.3. Sendmail 8.6 Sendmail 8.6.x from Berkeley is the latest major revision after sendmail5. It has wonderful built-in support for building under Linux. Just "make linux" and you'll be all set. 4.4. Other "transport agents" The following also are known to run under Linux. Consult "archie" for details regarding how to find them... o smail2.5 - very simple UUCP-based smail 4.5. Local Delivery Agents Unlike most operating systems, Linux does not have mail "built-in". You'll need a program to deliver the local mail. One good program is Rich Braun's "lmail" program, but I've switched to using the more commonly available "deliver" program. Documentation for how to use either for local delivery is in the sendmail5.67b+IDA1.5 binary release (on sunsite) mentioned above. 5. Mail "User Agents" This section contains information related to "user agents", which means the software the user sees and uses. This software relies on the "transport agents" mentioned above. 5.1. Elm Elm compiles, installs, and runs flawlessly under Linux up to and through Slackware 1.1.1 (gcc2.4.5, gcclib 4.4.4). For more information, see the elm sources and installation instructions. The only thing to know is that Elm's Configure script incorrectly sets the "ranlib" variable in config.sh. The Elm Development Team has been informed of this little problem, so please don't bother them with it (again). o from Chip Rosenthal - chip@chinacat.unicom.com The easiest way to deal with this is to create a file called config.over at the top of you Elm source tree and include the line: ranlib='ranlib' o Alternatively, you can just remember to correctly edit the line in config.sh when Configure gives you the chance to do so. o Elm and filter need to be mode 2755 (group mail) with /usr/spool/mail mode 775 and group mail. If you use a binary distribution, you'll need to create a /usr/local/lib/elm/elm.rc file to override the compiled-in hostname and domain information: o replace "subdomain.domain" with your domain name replace o "myhostname" with you un-domainized hostname replace o "my_uucp_neighbor" with the uucp name of your upstream site #---------- /usr/local/lib/elm/elm.rc ------------------ # # this is the unqualified hostname hostname = myhostname # # this is the local domain hostdomain = subdomain.domain # # this is the fully qualified hostname hostfullname = myhostname.subdomain.domain # #-------------------------------------------------------- One thing you want to be aware of is that if you have Elm compiled to be MIME-able, you need metamail installed and in your path or Elm will not be able to read MIME mail you've received. Metamail is available on thumper.bellcore.com and of course via "archie". We have heard reports that gcc and gcclib newer than v2.4.5 and v4.4.4 respectively are rather strict and fail to compile Elm. Here's the scoop as reported by ccnp@unitrix.utr.ac.za (Neil Parker) who forwarded a posting by longyear@netcom.com (Al Longyear). o ELM is using internal fields in the FILE structure in an effort to bypass the standards. (The _flag, _IOERR, and _IOEOF are old fields for the pre-POSIX runtime package. While POSIX doesn't say that you can't define these fields, it does not say that you _must_. Linux does not. It does say that programs should not be written to use them, even if they are in the implementation.) where it does if (fp->_flag & _IOERR) ... change it to if (ferror(fp)) .... where it does if (fp->_flag & _IOEOF) ... change it to if (feof(fp)) ... These are the ANSI/POSIX definitions for the same function. o While this item is not Linux-specific, it's a nagging bug nevertheless. We've heard that Elm sometimes fails with a message that it's unable to malloc() some massive number of bytes. This has been identified as an Elm Bug. The identified workaround is to remove the post-processed global mail aliases (aliases.dir and aliases.pag). o from scot@catzen.gun.de (Scot W. Stevenson) The current metamail package requires csh for some of its scripts. Failure to have csh (or tcsh) will cause most interesting errors... 5.2. Mailx There is a fine binary implementation of mailx located on the various Linux archive sites. Make sure you grab version 5.3b or later since there are security problems in v5.3a. The only potential problem I'm aware of is that it seems to be compiled in a way that requires /usr/lib/smail rather than /usr/lib/sendmail as a transport agent. You probably need a link if you run sendmail on your system. I strongly recommend removing the old "edmail" stuff from SLS1.00 and replacing it with mailx. 5.3. Other user agents The following also are known to run under Linux. Consult "archie" for details regarding how to find them... o Pine - from the Univ. of Washington o Metamail - allows MIME support o mh - yet another way to handle mail o deliver - file/process mail based on rules o procmail - file/process mail based on rules o Majordomo - manages e-mail lists o Mserv - provide files-by-mail 6. Acknowledgements The following people have helped in the assembly of the information (and experience) that helped make this document possible: Steve Robbins, Ian Kluft, Rich Braun, Ian Jackson, Syd Weinstein, Ralf Sauther, Martin White, Matt Welsh, Ralph Sims, Phil Hughes, Chip Rosenthal, Scot Stevenson, Neil Parker If I forgot anybody, my apologies...