On Fri, Feb 07, 2014 at 01:55:09PM -0500, Glenn Sieb wrote:
> This will do what you're looking for, much easier.
> 
> in main.cf:
> 
> mydomain =  arlut.utexas.edu
> 
> # SENDING MAIL
> #
> # The myorigin parameter specifies the domain that locally-posted
> # mail appears to come from. The default is to append $myhostname,
> # which is fine for small sites.  If you run a domain with multiple
> # machines, you should (1) change this to $mydomain and (2) set up
> # a domain-wide alias database that aliases each user to
> # user@that.users.mailhost.
> #
> myorigin = $mydomain
> 
> Best,
> --Glenn

Thanks for the reply, first off.

Just to make sure I was doing what I thought I was doing,
I did the following experiments.

I have a test box that delivers mail locally.  If it thinks it
shouldn't, for whatever reason, it sends the mail to the regular
mail server and it delivers it.  So, if I'm right, a "good" result
is when it's delivered locally, and a "bad" result is when the
mail gets shoved over to the regular channels.

The variables are:
relay_recipient_maps
recipient_canonical_maps
myorigin

Now, my understanding is that myorigin applies when sending mail.
It basically alters what the "from" address looks like to the
ultimate recipient.

With both relay_recipient_maps and recipient_canonical_maps defaulted,
I sent mail like so:
mail -s "gl bbb 12" g...@bbb.arlut.utexas.edu < /etc/motd

bbb isn't a machine here.
myorigin set to nothing -- postfix won't start.  Makes sense.
myorigin = crelm.toothpase -- postfix starts, the mail isn't delivered.
        Makes sense.
myorigin = shoogams.$mydomain -- delivered via regular channel (bad), w/
        from address of shoogams.$mydomain .  The "from" address I expected.
        I was hoping it would be delivered locally, but my production
        machine wasn't doing that either, so if I have some other
        combination of things wrong, then... then I'm wrong.   But this
        result is consistent w/ what I've seen before.
myorigin = $mydomain -- the default, and what I've had in place on my
        production boxes all along -- delivered through regular channels
        (bad) but has the "from" address I want.

So, eliminating myorigin as a variable.

In the rest, here are the two non-default values of these variables.
I had previously decided that relay_recipient_maps wasn't what I
wanted, but some other things happened to make me wonder.  So I
tested it.
relay_recipient_maps = regexp:/etc/postfix/pfrecipient_canonical
recipient_canonical_maps=regexp:/etc/postfix/pfrecipient_canonical

var/            value   y= value above, def= defaulted

rel...          y       def     def     y
recip...        def     def     y       y
myorigin        $mydomain throughout
result          reg/bad bad     good/locally

To my eyes, this means myorigin does do good things when defaulted,
but it doesn't do what I wanted/hoped.  It appears to me that
what I need is recipient_canonical_maps set to the value above
in order to get what I want.

Or am I missing something?

Here's the postconf -n output of the test box.
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd 
$daemon_directory/$process_name $process_id & sleep 5
html_directory = /opt/depot/postfix-2.8.4/html
inet_interfaces = all
inet_protocols = ipv4
local_recipient_maps = hash:/etc/postfix/users.here
mail_owner = postfix
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/local/man
message_size_limit = 0
mydestination = $mydomain, davis.$mydomain, aaa.$mydomain
mydomain = arlut.utexas.edu
myhostname = davis.arlut.utexas.edu
mynetworks = 127.0.0.0/8, 10.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /opt/depot/postfix-2.8.4/README
recipient_canonical_maps = regexp:/etc/postfix/pfrecipient_canonical
recipient_delimiter = +
relay_domains = vme.arlut.utexas.edu
relay_recipient_maps = regexp:/etc/postfix/pfrecipient_canonical
relayhost = vme.arlut.utexas.edu
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_data_restrictions = reject_multi_recipient_bounce
unknown_local_recipient_reject_code = 550

-- 
Jay Scott               512-835-3553            g...@arlut.utexas.edu
Head of Sun Support, Sr. System Administrator
Applied Research Labs, Computer Science Div.                   S224
University of Texas at Austin

Reply via email to