[EMAIL PROTECTED] writes: > From time to time I am still trying to convince exmh to use the login and > address of my ISP's account ([EMAIL PROTECTED]). > [ ... excerpts from PPP-HOWTO, on configuring MH ... ] > > But it didn't give me the correct From field. > [ ... more from PPP-HOWTO on configuring sendmail ... ] > > If I can't make step 0 to work and I don't use sendmail, is it possible to > convert this to something useful with smail ?
There are instructions for configuring smail to rewrite your From field, in the Debian FAQOMATIC (Courtesy of Daniel Gross <[EMAIL PROTECTED]> ): <http://www.debian.org/fom/137.html> I followed the instructions, and it works perfectly. But I had a little trouble at first, partly because in the FAQOMATIC, at least as it displays in my browser, the lines are broken in ways that would be invalid in the actual configuration files. I've also found there's an additional glitch when using mh (or exmh). So I'll paraphrase the instructions below, and expand on them a little. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * NOTE TO DEBIAN DEVELOPERS: Could something like this be added to the choices in the smailconfig script? It seems like such a common problem. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Here are the steps. 1. Create the file `/etc/smail/maps/from' (the file name is arbitrary, but is used in step 3 below). This file should give the mapping from local usernames, to valid Internet-email addresses. The syntax is localuser [EMAIL PROTECTED] (full name) Here `localuser' is your login name on your local machine; [EMAIL PROTECTED]' is the address you want to appear in the From field; and `full name' is your full name, as you want it to appear in the From field. So, for instance, if your local user name is `joe', and your email address is [EMAIL PROTECTED]', and your full name is `Joe W. Shmoe', you should have this line in /etc/smail/maps/from: joe [EMAIL PROTECTED] (Joe W. Shmoe) If there are other users on your local system, you should add the appropriate entry for each of them. 2. Edit `/etc/smail/routers', replacing every occurrence of `transport=smtp' with `transport=smtp-rewrite'. 3. At the bottom of `/etc/smail/transports', add the following 6 lines: smtp-rewrite: driver=tcpsmtp, max_addrs=100, -max_chars, inet, remove_header="From", insert_header="From: ${lookup:from:lsearch{maps/from}{$value}}", insert_header="Sender: ${lookup:from:lsearch{maps/from}{$value}}"; use_bind, defer_no_connect, -local_mx_okay, defnames [The syntax of all this is explained in the smail(5) man page.] IMPORTANT: Make sure you get all the punctuation exactly as it's shown. In particular, there are several commas, and only one semicolon. It's crucial that the semicolon be there, and not a comma! Lines 3-5 of the 6 lines above cause smail to replace the From and Sender fields of all outgoing mail, with new addresses that it gets from the `/etc/smail/maps/from' file, that you created in step 1. (Lines 2 and 6 are the same as in the `smtp' entry in /etc/smail/transports.) If you want, you can add a default value for the From and Sender fields, which should be used if no entry is found in maps/from, corresponding to the sender's local username. This would appear in braces, immediately following {$value} and before the final }. For example: ...${lookup:from:lsearch{maps/[EMAIL PROTECTED] ($fullname)}}", This would give a default return address of <[EMAIL PROTECTED]>, but would indicate the full name of the actual local user, even if it's not Joe Shmoe. (But this doesn't seem to work with mh -- see below). ---------- Now you should be able to send mail to the Internet, with most mail agents (command-line `mail', for example), and have a valid return address. However, for some reason which I don't quite understand, this doesn't work with mh (or exmh). Apparently, when sending mail from mh, the From field is initially set to [EMAIL PROTECTED]' instead of just `user', so it's looking for [EMAIL PROTECTED]' in /etc/smail/maps/from, and it doesn't find it. Furthermore, even if you've specified a default value as above, to be used if there's no matching entry in /etc/smail/maps/from, mh seems to ignore it, too. Can anyone explain why this happens? It almost looks as though mh is itself parsing the transports file -- bypassing smail -- but doing it incorrectly. Anyway, there's a simple fix: Just put an additional entry in /etc/smail/maps/from, corresponding to each existing entry, but with the local hostname appended to the username. So, in the example I used above, suppose the hostname of your local machine is `myhome'. Then there would be two entries in /etc/smail/maps/from: joe [EMAIL PROTECTED] (Joe Shmoe) [EMAIL PROTECTED] [EMAIL PROTECTED] (Joe Shmoe) Then mh finds the [EMAIL PROTECTED] entry, and everyone is happy. You may still get warnings in the logfile (/var/log/smail/logfile), since the message is initially presented with the [EMAIL PROTECTED] address; but no harm is done. Ultimately the message gets sent with the correct return address. -- David Zelinsky [EMAIL PROTECTED]