Date: Thu, 8 Jun 2006 08:05:55 +0300 From: a@zeos.net To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: freebsd-questions@freebsd.org Subject: Re: On mail principles Message-ID: <20060608050555.GA757@localhost> In-Reply-To: <20060607230852.GA77169@gothmog.pc> References: <20060607172044.GG923@localhost> <20060607230852.GA77169@gothmog.pc>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 08, 2006 at 02:08:53AM +0300, Giorgos Keramidas wrote: > On 2006-06-07 20:20, a@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@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@zeos.net". So, I make my MUA to send a > > letter using a command setting "envelope from" to "a@zeos.net". (like > > sendmail -f a@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') > FEATURE(`use_cw_file')dnl > > dnl Allow mail routing exceptions through a mailer table. > FEATURE(`mailertable', `hash /etc/mail/mailertable') > > dnl Address masquerading. > dnl > 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 > 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@ceid.upatras.gr'. > MASQUERADE_AS(`gothmog.pc') > FEATURE(`masquerade_entire_domain') > FEATURE(`masquerade_envelope') > > 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@ceid.upatras.gr' instead of the default > dnl envelope-from of `keramida@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') > GENERICS_DOMAIN(`gothmog.pc') > FEATURE(`generics_entire_domain') > > 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. > # > foo.com smtp:mailgate.foo.com > .foo.com smtp:mailgate.foo.com > > 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@localhost keramida@ceid.upatras.gr > giorgos@gothmog keramida@ceid.upatras.gr > giorgos@gothmog.pc keramida@ceid.upatras.gr > > These options are, of course, just a suggestion. You don't *HAVE* to > use a setup similar to mine. > > - Giorgos This is exactly what I want. Thank you. Elisej Babenko
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060608050555.GA757>