Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

On mail principles

0 views
Skip to first unread message

a...@zeos.net

unread,
Jun 7, 2006, 1:20:44 PM6/7/06
to
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?

In principle, I can write a ruleset (in sendmail.cf by hand)
for my sendmail to rewrite
"envelope from" in outgouing mail from "elisej@localhost" to "a...@zeos.net"
and to leave it unchanged in local mail.

But I think this is not a good solution, is it?

I use sendmail 8.13.6 on FreeBSD 6.1-RELEASE,
but the problem depends not on MTA nor on OS.

Elisej Babenko
_______________________________________________
freebsd-...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questi...@freebsd.org"

Charles Swiger

unread,
Jun 7, 2006, 5:43:23 PM6/7/06
to
On Jun 7, 2006, at 1:20 PM, a...@zeos.net wrote:
> 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?

See the sendmail documentation [1] on MASQUERADE_AS().

--
-Chuck

[1]: /usr/share/sendmail/cf/README, or check the FAQ from
www.sendmail.org...

Giorgos Keramidas

unread,
Jun 7, 2006, 7:08:53 PM6/7/06
to
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. `kera...@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. `kera...@ceid.upatras.gr' instead of the default
dnl envelope-from of `kera...@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 kera...@ceid.upatras.gr
giorgos@gothmog kera...@ceid.upatras.gr
gio...@gothmog.pc kera...@ceid.upatras.gr

These options are, of course, just a suggestion. You don't *HAVE* to
use a setup similar to mine.

- Giorgos

a...@zeos.net

unread,
Jun 8, 2006, 1:06:53 AM6/8/06
to
On Wed, Jun 07, 2006 at 05:43:23PM -0400, Charles Swiger wrote:
> On Jun 7, 2006, at 1:20 PM, a...@zeos.net wrote:
> >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?
>
> See the sendmail documentation [1] on MASQUERADE_AS().
>
> --
> -Chuck
>
> [1]: /usr/share/sendmail/cf/README, or check the FAQ from www.sendmail.org...

That is not a proper feature because of different local users can use world
mail addresses with different hostnames. But masquerading is good only for
one domain.

a...@zeos.net

unread,
Jun 8, 2006, 1:05:55 AM6/8/06
to
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?
>
This is exactly what I want.
Thank you.

Giorgos Keramidas

unread,
Jun 8, 2006, 7:26:57 AM6/8/06
to
On 2006-06-08 08:05, a...@zeos.net wrote:
>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.
>> > [...]
>>
>> [description of a masquerading+genericstable Sendmail setup]

>
> This is exactly what I want.
> Thank you.

Cool! If you need more help setting things up, let us know :)

Alex Zbyslaw

unread,
Jun 8, 2006, 8:57:08 AM6/8/06
to
a...@zeos.net wrote:

>On Wed, Jun 07, 2006 at 05:43:23PM -0400, Charles Swiger wrote:
>
>

>>On Jun 7, 2006, at 1:20 PM, a...@zeos.net wrote:
>>
>>
>>>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?
>>>
>>>
>>See the sendmail documentation [1] on MASQUERADE_AS().
>>
>>--
>>-Chuck
>>
>>[1]: /usr/share/sendmail/cf/README, or check the FAQ from www.sendmail.org...
>>
>>
>

>That is not a proper feature because of different local users can use world
>mail addresses with different hostnames. But masquerading is good only for
>one domain.
>
>

I believe newer postfixes have support for "masquerading" different
local users with different external addresses when sending mail
externally. Haven't tried it: just noted the feature in some email
somewhere for future evaluation, so take with the usual pinch of salt.

--Alex

Andrey Slusar

unread,
Jun 8, 2006, 4:15:34 PM6/8/06
to
Thu, 8 Jun 2006 02:08:53 +0300, Giorgos Keramidas wrote:
[...]

> 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:

You need write the howto "sendmail for newbies" :)

--
Regards,
Andrey.

Giorgos Keramidas

unread,
Jun 9, 2006, 6:17:47 AM6/9/06
to
On 2006-06-08 23:15, Andrey Slusar <anr...@gmail.com> wrote:
>Thu, 8 Jun 2006 02:08:53 +0300, Giorgos Keramidas wrote:
>[...]
>> 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:
>
> You need write the howto "sendmail for newbies" :)

Thanks. I keep saying to myself that we need task-based guides in our
Handbook, separated by user-type (i.e. "Sendmail for FreeBSD Users",
"Sendmail for FreeBSD Administrators", etc.)

Right now, I don't have the time to do something like this, but summer
and vacations is a good period for a bit of this sort of work :)

Andrey Slusar

unread,
Jun 9, 2006, 9:37:19 AM6/9/06
to
Thu, 8 Jun 2006 02:08:53 +0300, Giorgos Keramidas wrote:

> 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

^^^^^^^^^^^
Small mistake - FEATURE(`use_ct_file')dnl.

--
Regards,
Andrey.

Giorgos Keramidas

unread,
Jun 9, 2006, 11:35:02 AM6/9/06
to
On 2006-06-09 16:37, Andrey Slusar <anr...@gmail.com> wrote:
> Thu, 8 Jun 2006 02:08:53 +0300, Giorgos Keramidas wrote:
>
> > 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
> ^^^^^^^^^^^
> Small mistake - FEATURE(`use_ct_file')dnl.

Ah, thanks! I knew I would do something stupid by copy-pasting only
the relevant bits from my real *.mc file :)

0 new messages