We help IT Professionals succeed at work.

Need help configuring postfix correctly

Doug Poulin
Doug Poulin asked
on
Having problems getting postfix set up correctly.
In my case the server has several virtual domains. I have a system API that sends out emails and I want any bouncebacks to come to it.  It's not the primary domain for the server.

Assuming abc.com is the primary domain and def.com is the one I need work, I have the following entries in various configuration files:

local-host-names:
def.com

access:
def.com OK

virtual
mail_notifier@def.com mail_notifier@localhost
(I've also tried)
mail_notifier@def.com mail_notifier

I can't use the primary domain because we use office 365 and the mail MX record points to microsoft not our server.  This is also our web server, so I can't mess with the primary domain address.

The error I get back is
Recipient address rejected. User unknown in virtual alias table.

All I want to do is collect the bouncebacks from the mail_notifier account so I can automate handling for the end users.  Any help is appreciated.
Comment
Watch Question

Author

Commented:
Here's the content of postconf -n (if this helps)
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
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = all
inet_protocols = all
local_recipient_maps = unix:passwd.byname $alias_maps
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
myhostname = host1.abc.com
mynetworks = 209.217.75.192/28, 209.217.83.48/29, 10.10.0.0/24
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
virtual_alias_domains = def.com


Also here';s the result from the postmap query

postmap -q mail_notifier@def.com virtual        
mail_notifier
Commented:
Even though it's not in the main.cf file by default (or a comment) you need to set
virtual_alias_maps = hash:/etc/postfix/virtual

and get virtual in the right format.

username@def.com username

Make sure you postmap the file so that the db file is up to date.
run postfix reload

You can test by entering the following commands
telnet def.com 25
ehlo abc.com
mail from:doug
rcpt to:mail_notifier@def.com

If you don't get an error returned then you're golden.