Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have postfix v2.6.6 running on CentOS 6.3, hostname priest.ocsl.local (private, internal domain) with a number of aliases

supportpeople: user1@ocsl.co.uk, user2@ocsl.co.uk, user3@ocsl.co.uk
requests: "|/opt/rt4/bin/rt-mailgate --queue 'general' --action  correspond --url http://localhost/", supportpeople
help: "|/opt/rt4/bin/rt-mailgate --queue 'help' --action correspond --url http://localhost/", supportpeople

If I leave postfix with its default configuration, then the aliases are resolved correctly/as I expect, so that incoming mail to, say, rt@ocsl.co.uk will be piped through the rt-mailgate mailgate command and also be delivered (via the mail server for ocsl.co.uk (a publicly resolvable domain)) to user1@ocsl.co.uk, user2, etc.

The problem comes when I define mydomain = ocsl.co.uk in /etc/postfix/main.cf (with the intention that outgoing mail come from, for example, help@ocsl.co.uk). When I do this, postfix continues to run the piped command correctly, however it no longer expands the nested aliases as I expect: instead of trying to deliver to user1@ocsl.co.uk, user2 etc, it tries to send to supportpeople@ocsl.co.uk, which does not exist on the upstream mail server and generates NDRs. postconf -n for the non-working configuration follows (the working configuration differs only by the "mydomain" line.

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = ocsl.co.uk
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

We did have things working as we expected/wanted previously on an older system running Sendmail.

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

The supportpeople values do not have a domain part in your $alias_maps, thus Postfix appends $mydomain to them (because of $append_dot_mydomain). With mydomain = ocsl.co.uk Postfix expands supportpeople to supportpeople@ocls.co.uk and tries to route the mail to the MX for that domain. To avoid that, change the right-hand supportpeople values to a full address for which your Postfix is the final destination, e.g. supportpeople@localhost.

Besides, for changing the sender address you'd use $myorigin, not $mydomain.

share|improve this answer
    
I thought $myorigin was by default, set to $mydomain. Obviously it affects others things too. –  Norky Oct 9 '12 at 8:11
    
Thank you @Angsar, setting the alias destination to supportpeople@ocls.co.uk made things work as I wanted. –  Norky Oct 9 '12 at 8:35
    
The above is incorrect. $mydomain is never appended to localparts, it is appended to bare hostnames. $myorigin is appended to bare locaparts if append_at_myorigin is set. –  adaptr Oct 9 '12 at 8:36
    
@adaptr Hmm... weird. I re-checked and it turns out you're right. However, the OP's setup should have worked then even with mydomain = ocls.co.uk, since $myorigin defaults to $myhostname, which is a final destination according to his config. –  Ansgar Wiechers Oct 9 '12 at 17:31
    
mydomain != myhostname != myorigin –  adaptr Oct 11 '12 at 8:25
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.