0

I have a standard Postfix server on one of my servers and I have not set up anything so far. What I wish to achieve is: In a MySQL database I want to store email addresses that are accepted by Postfix. Everything else should be rejected.

I've read a lot of "HOWTO"s but now I'm getting very confused about it. The steps are ??

  • Create a database with a table containing id, address, status (like 1,anulu@example.com,OK)

  • Create a cfg file in /etc/postfix to tell theDB connection details + a query something like: select status from users where address='%s' (What is %s BTW??? )

  • Add to main.cfg the following: smtpd_recipient_restrictions = check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf

  • Restart postfix and viola....

Not the last part, the "voila" isn't doing it for me. What did I get wrong in this idea?

I always get the following back:

Mar 25 12:46:40 myserver postfix/local[32436]: 6D1C88XXX: to=<anyone@mydomain.com>, relay=local, delay=0.21, delays=0.15/0.03/0/0.02, dsn=5.1.1, status=bounced (unknown user: "anyone")

While in the DB I have a row with: id:1, address:anyone@mydomain.com, status:OK

0

Ha... Ha... NVM me. Once again, uploaded a question just to find the sollution pretty mutch right after. :D So what I was doing wrong is I've missed the luser_relay to forward all messages to an existing user and forwatd the local recipient map to the DB. To SUM it all up, here is what you have to do:

/etc/postfix/main.cf

  • myhostname = mail.myserver.com
  • mydomain = myserver.com
  • myorigin = $mydomain
  • inet_interfaces = all
  • mydestination = $myhostname, localhost, $mydomain
  • mynetworks = 127.0.0.0/8, MY.SERVERS.IP.ADDRESS/32
  • relay_domains = $mydestination
  • home_mailbox = Maildir/
  • luser_relay = mailuser@myserver.com
  • local_recipient_maps = mysql:/etc/postfix/vmailbox

/etc/postfix/vmailbox

  • user = dbadmin
  • password = SECRET
  • hosts = localhost
  • dbname = mailserver
  • query = SELECT id FROM places WHERE email='%s'

and NOW we can talk about any voila :)

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.