Richard Wurman wrote:
I'm attempting to get sender_dependent_relayhost_maps working on
postfix 2.5.1. What I'm trying to do is this: all mail from
[EMAIL PROTECTED] should be sent out from a different mail server,
because SPF has been set to that IP address. All others should use the
default relay, indicated in main.cf's relayhost entry.

From googling around I thought it was as simple as defining the map
file in main.cf and then indicating in that file, which domain I want
to match on, (with @ at the beginning) and what the target relay
server should be.  I know for sure that mail "can" get to 192.168.10.3
when I set 192.168.10.3 as the relayhost in main.cf.  Am I missing
something?

==  output from postconf -n ==
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
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
mynetworks = 192.168.0.0/16, 127.0.0.1/32
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.5.1/README_FILES
relayhost = [192.168.10.5]
sample_directory = /usr/share/doc/postfix-2.5.1/samples
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_maps
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

==  cat /etc/postfix/sender_maps ==
@domain1.com    192.168.10.3


As documented, relayhost takes precedence over sender_dependent_relayhost_maps.
http://www.postfix.org/postconf.5.html#sender_dependent_relayhost_maps

Rather than setting relayhost in main.cf, you can use a regexp sender_dependent_relayhost_maps with a catchall at the end.
Something like:

# main.cf
relayhost =
sender_dependent_relayhost_maps =
  regexp:/etc/postfix/sender_maps.regexp

# /etc/postfix/sender_maps.regexp
/@example\.com$/  [192.168.10.3]
/./  [192.168.10.5

- do not index a regexp table with postmap.
- you can use pcre rather than regexp above if your postfix supports pcre tables.

--
Noel Jones

Reply via email to