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've recently signed up to SMTP2GO (smtpcorp). I've setup postfix on one of EC2 servers and have pointed it to my smtp2go account:

relayhost = []:2525

Now all my mail is being routed through SMTP2GO, but the issue is, that the 1000+ emails that are generated by cron job ect are being sent to SMTP2GO using the email address:

My question is, what would be the best way to stop all these "local" emails being routed to SMTP2GO?




smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

append_dot_mydomain = no

readme_directory = no

smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

myhostname =

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname

mydestination =,, localhost

relayhost = []:2525
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:account:password
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
share|improve this question
up vote 2 down vote accepted

Postfix relayhost doesn't send local mail to the relayhost normally:


relayhost (default: empty)

The next-hop destination of non-local mail; overrides non-local domains in recipient addresses. This information is overruled with relay_transport, sender_dependent_default_transport_maps, default_transport, sender_dependent_relayhost_maps and with the transport(5) table.

So if it is happenning, it is because your local mail is not identified as local. You need to include your local domain in mydestination = config line. I see you have the there but probably you have defined a local domain different than this one for your LAN. If you don't have defined a local domain, I think (needs testing) if you only add localhost.localdomain localhost in your etc/hosts file and add localhost.localdomain to mydestination= it should be sufficient.

share|improve this answer
I think this did it! All i did was take the offending domain and append it to the domains in "mydestination =" , now i'm not getting any more of the 'internal' emails, thanks a lot! – user149631 Dec 14 '12 at 15:30

It is sending the output of cron etc. to the root account on the server, as per the default settings in Ubuntu.

To have all mail sent to this address diverted somewhere else, edit your aliases file to include the following line:

enter code hereroot: ""

Then run newaliases. This works with postfix ok.

Alternatively you could set up forwarding of all mail to root by adding/editing ~root/.forward and adding a line with the preferred email address.


share|improve this answer
Thanks dunxd, do you know if there is a way so that the emails don't leave the server? Currently 90% of outbound mail is from cronjobs. Preferrably it would be nice to store these emails on the filesystem, and not have the routed to SMTP2GO, Thanks! Martin – user149631 Dec 14 '12 at 12:19
See what laurent said - I misunderstood your question – dunxd Dec 14 '12 at 15:30

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.