I'm working on an application which only accepts email coming from the google mail servers. The challenge is, the applications doesn't know, upfront, which domains to accept and so i need Postfix to accept email from all domains.

  • This is the end point for all email, no relaying being done
  • Only accept mail from the Google Apps servers:

    dig txt _spf.google.com | grep spf |format_spf.py > /etc/postfix/network_table
    mynetworks = hash:/etc/postfix/network_table
    smtpd_client_restrictions = permit_mynetworks, reject
  • Email not accepted by any local alias is being forwarded to a catch-all user where it is processed by procmail:

    luser_relay = catch-all-user
    mailbox_command = /usr/bin/procmail -Y -a $DOMAIN
  • At this point i can't accept mail without a table containing the domains:

    mydestination = hash:/etc/postfix/mydestination_table

So, how can i get rid of the "mydestination" table?


  • Is this a test environment in a closed system? Otherwise how could it possibly be the end point for all email? Am I taking you to literally when you say all email. I'm confused by your first and second bullet point. They seem to cancel each other.
    – Patrick R
    Jan 23, 2010 at 15:05
  • Email from Google Apps accounts is being forwarded to this application which extracts and stores the information from the messages. Because i don't know i advance from which Google Apps accounts the emails are coming i need to accept all email coming from the Google Apps servers.
    – user32657
    Jan 23, 2010 at 17:10

2 Answers 2


You mean you want Postfix to be an open relay?

This could solve this problem:

smtpd_client_restrictions = permit
  • Thanks, relay requests from the servers described in 'mynetworks' seem the only ones to be accepted although i don't understand why because i now have two values for smtpd_client_restrictions, 'smtpd_client_restrictions = permit_mynetworks, reject' and 'smtpd_client_restrictions = permit'
    – user32657
    Jan 23, 2010 at 17:15
  • There should be only one smtpd_client_restrictions line with one or more parameters. The parameters can be seen as "policies' that are evaluated in sequence. If you want to see the actual configuration of the running instance of postfix, you can do it via "postconf -d". A smtpd_client_restrictions directive of a public Postfix can be very long (mine hase more than 15 "policies")
    – lrosa
    Jan 23, 2010 at 17:58
  • The default setting for 'smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination' must have accepted the relay from hosts in 'mynetworks'.
    – user32657
    Jan 23, 2010 at 22:58

You guys are stars!

I would like to mention that I also had to include the smtpd_relay_restrictions = permit. So I have these two additional lines:

smtpd_relay_restrictions = permit smtpd_client_restrictions = permit

And that worked like a charm for open relay (off course I have a firewall ensuring this is only open from INSIDE my network and not from the Internet!!)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy