[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Continuing Smail configuration stuff



You should to refer to `man 5 smail' and `man 8 smail' when reading
this.  See the end of this message for the meanings of the From: line,
Reply-To: line and return path.


We can solve all possible problems with the From: line easily in
/etc/smail/config:

        from_field="From: ${lookup:sender:lsearch{/etc/smail/senders} \
                {$value} \
                {$sender${if def:sender_name: ($sender_name)}}}"

This will perform lookups in a file called /etc/smail/senders, which
should consist of key-value pairs, e.g. on mine I have just one line:

richard         richard@uk.geeks.org (Richard Kettlewell)
^^^^^^^         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 \ local userid  \
                  contents of From: field to use

You should see richard@uk.geeks.org in the From: line of this message
for precisely this reason.

If there's no entry in /etc/smail/senders then it falls back to the
usual default, which is to append visible_name when it sends the mail
out.

(If a Sender: field needs to be generated then Smail uses the same
logic as for the From: field, so that's all OK.)

A more elegant solution would be to take the personal name bit outside
the lookup, probably as follows:

        from_field="From: ${lookup:sender:lsearch{/etc/smail/senders} \
                {$value} \
                {$sender}}${if def:sender_name: ($sender_name)}"

...but I haven't tested this.


Now to get the return path right you have to set the visible_name to
be the right thing - e.g. if your email address is `fred@isp.com' then
it should be `isp.com' - and have your userid on your system the same
as the user part of your email address (`fred' in this example).

If you do this then you'll want to set the hostnames variable to
something not including the name of your ISP - otherwise Smail will
try to deliver locally any mail sent to other customers of the same
ISP.

It doesn't seem to be possible to persuade Smail directly to vary the
return path on a per-user basis, which is something that would be
quite handy.

This all gets nastier still if you're downloading email by SMTP
instead of (say) POP or IMAP, and I can't see a way round that one
yet.  (It's not a problem at all if you have your own mail domain, as
I do and as each customer of Demon Internet does, for example; in that
case you can set your mail system up much more sanely in the first
place.)


The return path problem isn't too hard to solve, though.  You need to
get the -f option onto Smail somehow; a wrapper is required.  This
wrapper should check if the command line has a -f option already and
if so just exec Smail with the same arguments.

If it doesn't it should look up the user in some file (such as
/etc/smail/senders, and strip any (RFC822 comments) that it finds) and
add the appropriate -f option, and then exec Smail.

One could either do this by making all users trusted_users in
/etc/smail/config, or (more sensibly) by making the wrapper setgid to
a trusted_group.  Now we just need someone to write it...


Right, let's see how that From: line turns out l-)

Appendix:

From: line
	This is the address that appears in the headers of
	your mail message.  It needs to be correct so that the
	sender is identfied, and so that replies are directed
	to the right place.

Reply-to: line
	A header line which directs replies to some place
	other than the originator of the message.

Return path
	This is the address passed to mail transfer agents as
	the sender address.  Bounces will be directed here,
	and some (broken) mail user agents will attempt to
	direct replies here.

	It is NOT a header.

	It is added to the headers as Return-Path: at the
	point of delivery, but not before, so sticking in an
	extra header isn't good enough.

-- 
Richard Kettlewell
http://www.elmail.co.uk/staff/richard/                    richard@uk.geeks.org

                   It was definitely murder - but was it art?


Reply to: