On mail principles
keramida at ceid.upatras.gr
Thu Jun 8 01:35:02 UTC 2006
On 2006-06-07 20:20, a at zeos.net wrote:
> A brief:
> How to use "envelope from" provided that I have a mailbox on ISP.
> A full explanation:
> My computer has no static IP-address, nor DNS-name in Internet.
> Internally, it has static name "localhost" and static IP-address 127.0.0.1.
> So, I have a mail address "elisej at localhost".
> But I cannot send a mail to the world using this address in "envelope from"
> because of
> 1) Internet MTAs cancel mail whith such an address in "envelope from";
> 2) such an address is useless to recipient.
> My address in the world is "a at zeos.net". So, I make my MUA to send a
> letter using a command setting "envelope from" to "a at zeos.net". (like
> sendmail -f a at zeos.net for sendmail, see "X-Authentication-Warning" in
> the header of this mail) But this way is bad for local purposes: my
> MTA's diagnostic messages are sent trough internet or lost at all,
> e. g. when my ADSL is in down. (Moreover, my letters sent to other
> local users have non-local "envelope from" address. Then local mail
> begin to go through external MTA.)
> What to do in such a situation?
I use mutt, which has an option to set the envelope-from address:
set envelope_from=yes # set the envelope-from address from From:
For the rest of the programs, like mail(1), my Sendmail setup sets
envelope-from to one of my valid outside-world addresses. This is
accomplished with the following in my `sendmail.mc' file:
dnl Trusted users, who are allowed to change their envelope-from address
dnl without generating a warning in the message header, are listed, one per
dnl line, in `sendmail.ct'.
define(`confCT_FILE', `-o /etc/mail/sendmail.ct')
dnl Allow mail routing exceptions through a mailer table.
FEATURE(`mailertable', `hash /etc/mail/mailertable')
dnl Address masquerading.
dnl Making sure that all email that passes through my desktop's Sendmail
dnl installation is masqueraded as coming from `gothmog.pc', even if its original
dnl address is something slightly different (i.e. `ftp.pc' or `mail.pc'), is
dnl ok here. It ensures that address rewriting and translation through
dnl `genericstable' will also work for all `*.pc' host names.
dnl To make sure that remote hosts don't get a MAIL FROM address from a
dnl hostname that doesn't resolve, envelope addresses are masqueraded too, and
dnl then get rewritten by `genericstable' to real-world addresses,
dnl i.e. `keramida at ceid.upatras.gr'.
dnl Rewriting the envelope-from address of all outgoing messages through a
dnl `genericstable' lookup, ensures that envelope-from addresses seen by relay
dnl hosts are real, i.e. `keramida at ceid.upatras.gr' instead of the default
dnl envelope-from of `keramida at flame.pc' that Sendmail would use. This is
dnl required some times, to avoid getting bounces for messages from ISP mail
dnl relays that are misconfigured or are too strict about what can appear in a
dnl MAIL FROM command.
FEATURE(`genericstable', `hash -o /etc/mail/genericstable')
This looks like quite a mouthful of options, but it's not really that
difficult to read. It's only big because of all the comments.
The file `/etc/mail/sendmail.ct' contains my username, because I trust
myself to use valid envelope-from addresses. This turns off the
"X-Authentication-Warning" header which is so annoying for you too.
Then, in `/etc/mail/mailertable' I have an exception for my internal,
work-related email, and send it directly to the company's mail gateway:
# Custom mail routing rules. This is currently useful only
# for routing work-related email through the VPN connection
# to my company's mail relay.
Finally, in my `/etc/mail/genericstable' map, I rewrite the
envelope-from of all the rest of email messages, like this:
# Outgoing email address rewriting.
giorgos at localhost keramida at ceid.upatras.gr
giorgos at gothmog keramida at ceid.upatras.gr
giorgos at gothmog.pc keramida at ceid.upatras.gr
These options are, of course, just a suggestion. You don't *HAVE* to
use a setup similar to mine.
More information about the freebsd-questions