This problem caused me quite a bit of grief, nearly a whole day of tweaking and learning and finally I figured it out.
The problem was a password mismatch. I guess I had a weird character in my mySQL password, that I didn’t have in my query string.
A little more background.
I’ve been configuring a postfix mail engine with a mySQL database, using table lookups and virtual hosts. (Note: if you’re looking for a great tutorial, you can find one at flurdy.com)
According that that tutorial, I had set up everything as it asked, so I went to test the configuration using a telnet session through my SSH interface Putty.
It would consistently allow me to start my give me the error very similar to:
telnet localhost 25
Connected to localhost.220 my.domain ESMTP Postfix (Ubuntu)
MAIL FROM: root
250 2.1.0 Ok
RCPT TO: root
451 4.3.0 <root>: Temporary lookup failure
221 2.0.0 Bye
It should be clear the 451 4.3.0 Temporary lookup failure was not a good thing.
Looking at my mail.log files, I should have clued in earlier since it was saying:
warning: mysql:/etc/postfix/mysql_alias.cf lookup error for “email@example.com”
warning: virtual_alias_maps map lookup problem for firstname.lastname@example.org — deferring delivery
What I kept doing was looking at the mysql_alias.cf file and double checking all of the configurations, making sure it all worked.
What I should have done was immediately try using postmap. To use this, I tested with the following query:
sudo postmap -q <domain I have added to my mailboxes file (any domain will return something really)> mysql:/etc/postfix/mysql_mailbox.cf
What this basically does is use the handy postmap program, which can be used to quickly test your postfix installation, to query mySQL using the mysql_mailbox.cf configuration file, and the query string supplied.
postmap: warning: connect to mysql server 127.0.0.1: Access denied for user ‘<user>’@’localhost’ (using password: YES)
postmap: fatal: table mysql:/etc/postfix/mysql_mailbox.cf: query error: Success
Well, obviously it was trying to send the query, but the mySQL db wasn’t letting it get in!
A quick test now connecting to the database:
mysql -u <user> -p
And entering the password when prompted that I was using returned another Access denied for user.
So, as stated at the start, the problem was simply solved by re-entering the password used for the user I was trying to access the database with. After doing this, the quick connect to database test mysql -u <user> -p allowed me access, and everybody is happy!
Hope this helps!
I referenced workaround.org’s Postfix Configuration page for help using the postmap query.
I also referenced Postfix’s manual for table 5, relating to the mySQL query configuration file.
I had the same error. I doubled-checked all my config files. Then I saw your post. Than you, man, you just saved me hours of frustration.
thanks for posting
happy to help 🙂