Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following problem, I have a Centos 5.4 VPS hosting a few nginx sites (some static, some cakephp), I would like to be able to send email from each sites contact page through postfix to my google apps hosted email (different accounts for each site) so that apps can then send out an auto email to the person filling in the contact form etc

I have a bare-bones postfix installation with the following added into the config file. from using this guide

virtual_alias_domains = hash:/etc/postfix/virtual_alias_domains
virtual_alias_maps = hash:/etc/postfix/virtual_alias_maps

(both of these files have been converted into db files using postmap)

I have configured DNS correctly for each site and setup SPF records. (I'm aware R-DNS will still reference my actual hostname not the domain name and cause a possible spam issue but one thing at a time)

I can telnet localhost and the helo localhost so that I can send a command line email from an address in the virtual_alias_domains to an email in the virtual_alias_maps file which seems sends without giving an error but it is sending to my local linux account not the email address specified.

my question is am i approching this the wrong way in terms of the virtual alias mapping or is this even possible to do in the manner im trying. Any help is greatly appreciated thanks.

my postconf -n outlook looks like this

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = localhost
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
myhostname = myactual hostname
mynetworks =
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
virtual_alias_domains = hash:/etc/postfix/virtual_alias_domains
virtual_alias_maps = hash:/etc/postfix/virtual_alias_maps
share|improve this question
up vote 2 down vote accepted

would appear im trying to do it in a much too complicated way.

this guide seems to have worked,

all i did was to declare my actual hostname and make the change to mydestination the guide advises and im set to go, i can specify the from address and alls well............

share|improve this answer

virtual_alias_maps/domains Is for incoming e-mail only. If you intent to use your Postfix installation for outgoing e-mail only you don't need Postfix' virtual-hosting at all. Just make sure you haven't configured Postfix to accept mail for local delivery addressed to domains which has to be sent to the rest of the world.

Edit: No i'm talking about mydestination, from the comments in

# The mydestination parameter specifies the list of domains that this
# machine considers itself the final destination for.
# These domains are routed to the delivery agent specified with the
# local_transport parameter setting. By default, that is the UNIX
# compatible delivery agent that lookups all recipients in /etc/passwd
# and /etc/aliases or their equivalent.

So you don't want any of the domains you want to send e-mail to to be listed in your mydestination. If they are, the e-mail will be delivered locally.

inet_interfaces Is for receiving only. When your configuration is working properly you could try to not listen on any public interfaces to make your installation more secure. I'm not exactly sure what the side effects are of disabling this for all public interfaces.

share|improve this answer
do you mean to leave my inet_interfaces = localhost ie not to accept connections from outside, i dont have firewall rules setup for this anyway? – seanl Apr 12 '10 at 15:04
thanks for the clarification. I will try and see if i can limit the interfaces as you suggest for security reasons but i seem to have what i want with the config in the guide below and as i said above i dont have firewall rules set for postfix so i cant be relaying or anything like that etc – seanl Apr 12 '10 at 18:56

Your Answer


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.