Error receiving emails "unknown user in recipient table"
I am rebuilding my email server after wiping my Ubuntu 20.04 and installing 22.04. I can send emails, and the diagnostic tests for Postfix given in the guide Email with Postfix, Dovecot and MySQL --> Testing Postfix all pass, indicating that the data in the MySQL tables is being accessed correctly.
When receiving an email, mail.log shows the following error:
Dec 30 21:07:36 adonax postfix/smtpd[302379]: NOQUEUE: reject: RCPT from sonic312-25.consmr.mail.ne1.yahoo.com[66.163.191.206]: 550 5.1.1 phil@adonax.com: Recipient address rejected: User unknown in local recipient table; from=philfrei@aol.com to=phil@adonax.com proto=ESMTP helo=<sonic312-25.consmr.mail.ne1.yahoo.com></sonic312-25.consmr.mail.ne1.yahoo.com>
I've verified that "phil@adonax.com" is in value in the email field of the virtual_users table.
Before getting too deep into all the configurations, I have a question about logging into MySQL. In the section Create a MySQL Database for Your Postfix Email Server, step 4, we are told to add the user "mailuser" using the following line:
CREATE USER 'mailuser'@'127.0.0.1' IDENTIFIED BY 'password';
When I tried, as a test, to login to MySQL as 'mailuser', I get the following error:
fgphil@ladonax:~$ sudo mysql -u mailuser -p
Enter password:
ERROR 1045 (28000): Access denied for user 'mailuser'@'localhost' (using password: YES)
Note that the command to open MySQL is automatically appending "localhost". In my user table, the host field value is "127.0.0.1", not "localhost". If I drop and re-create mailuser with localhost as the "host" value, I'm able to log into MySQL. But I still get the same error message when receiving an email. Are there other configuration file settings that must also be made? I'm shaky on how 127.0.0.1 and localhost may or may not be interchangeable, so that's part of why I am looking at this first.
Another possible place that there was a fail might be due to how the password encryption is or isn't working. One of the comments in the article, which was entered as (a github issue)[https://github.com/linode/docs/issues/3902] alleges that the ENCRYPT function in MySQL is not working. But the engineer reviewing this didn't replicate the problem, or, made some changes to the documentation that should have fixed the issue, if I am reading the reply correctly.
I've checked port availability and it is fine.
The doveadm tool is able to successfully look up my email address, identifying the correct maildir.
Thanks for any help.
3 Replies
I have added verbose logging for both Dovecot and Postfix. Nothing appears in the dovecot.log file except an entry for when I restarted the service.
For postscript, here is an excerpt of my latest try, emailing from philfrei@aol.com to the email address on linode: phil@adonax.com.
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: recipient_canonical_maps: phil@adonax.com: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: recipient_canonical_maps: phil: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: recipient_canonical_maps: @adonax.com: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: mail_addr_find: phil@adonax.com -> (not found)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: canonical_maps: phil@adonax.com: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: canonical_maps: phil: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: canonical_maps: @adonax.com: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: mail_addr_find: phil@adonax.com -> (not found)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: virtual_alias_maps: phil@adonax.com: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: virtual_alias_maps: phil: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: virtual_alias_maps: @adonax.com: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: mail_addr_find: phil@adonax.com -> (not found)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr request = lookup
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr table = unix:passwd.byname
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr flags = 524352
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr key = phil@adonax.com
Dec 31 10:11:06 adonax postfix/smtpd[310743]: private/proxymap socket: wanted attribute: status
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute name: status
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute value: 1
Dec 31 10:11:06 adonax postfix/smtpd[310743]: private/proxymap socket: wanted attribute: value
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute name: value
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute value: (end)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: private/proxymap socket: wanted attribute: (list terminator)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute name: (end)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: dict_proxy_lookup: table=unix:passwd.byname flags=lock|utf8_request key=phil@adonax.com -> status=1 result=
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: local_recipient_maps: phil@adonax.com: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr request = lookup
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr table = unix:passwd.byname
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr flags = 524352
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr key = phil
Dec 31 10:11:06 adonax postfix/smtpd[310743]: private/proxymap socket: wanted attribute: status
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute name: status
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute value: 1
Dec 31 10:11:06 adonax postfix/smtpd[310743]: private/proxymap socket: wanted attribute: value
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute name: value
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute value: (end)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: private/proxymap socket: wanted attribute: (list terminator)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute name: (end)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: dict_proxy_lookup: table=unix:passwd.byname flags=lock|utf8_request key=phil -> status=1 result=
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: local_recipient_maps: phil: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr request = lookup
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr table = unix:passwd.byname
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr flags = 524352
Dec 31 10:11:06 adonax postfix/smtpd[310743]: send attr key = @adonax.com
Dec 31 10:11:06 adonax postfix/smtpd[310743]: private/proxymap socket: wanted attribute: status
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute name: status
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute value: 1
Dec 31 10:11:06 adonax postfix/smtpd[310743]: private/proxymap socket: wanted attribute: value
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute name: value
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute value: (end)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: private/proxymap socket: wanted attribute: (list terminator)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: input attribute name: (end)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: dict_proxy_lookup: table=unix:passwd.byname flags=lock|utf8_request key=@adonax.com -> status=1 result=
Dec 31 10:11:06 adonax postfix/smtpd[310743]: maps_find: local_recipient_maps: @adonax.com: not found
Dec 31 10:11:06 adonax postfix/smtpd[310743]: mail_addr_find: phil@adonax.com -> (not found)
Dec 31 10:11:06 adonax postfix/smtpd[310743]: NOQUEUE: reject: RCPT from sonic309-21.consmr.mail.ne1.yahoo.com[66.163.184.147]: 550 5.1.1 phil@adonax.com: Recipient address rejected: User unknown in local recipient table; from=philfrei@aol.com to=phil@adonax.com proto=ESMTP helo=<sonic309-21.consmr.mail.ne1.yahoo.com></sonic309-21.consmr.mail.ne1.yahoo.com>
About all I could get from this is that the fail is occurring in Postfix.
Here are the test lines, using postmap, which passed.
fgphil@ladonax:/etc$ sudo postmap -q adonax.com mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
1
fgphil@ladonax:/etc$ sudo postmap -q phil@adonax.com mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
1
From within mysql, contents of the tables:
mysql> select * from virtual_domains;
+----+------------+
| id | name |
+----+------------+
| 1 | adonax.com |
+----+------------+
1 row in set (0.00 sec)
mysql> select * from virtual_users;
+----+-----------+------------------------------------------------------------------------------------------------------------+-----------------+
| id | domain_id | password | email |
+----+-----------+------------------------------------------------------------------------------------------------------------+-----------------+
| 1 | 1 | [intentionally obscured] | phil@adonax.com |
+----+-----------+------------------------------------------------------------------------------------------------------------+-----------------+
1 row in set (0.00 sec)
I'm shaky on how 127.0.0.1 and localhost may or may not be interchangeable, so that's part of why I am looking at this first.
localhost is a domain name. 127.0.0.1 is an IP address. In the context of DNS, the two are interchangeable (provided you've set set up the name localhost as resolving to 127.0.0.1…every Linuxen/Windoze/BSDen/etc I've ever dealt with since like the mid-1980s has had an entry for this in /etc/hosts).
However, in the context of mysql, for purposes of a data item/value in a database, the two are NOT interchangeable.
If you don't anticipate a lot of users of your mail server, you might consider using sqlite3 as your account credentials store. It's much easier to manage (a single file) and debug and there's no database server overhead. The sqlite3 library is a shared library called by postfix/dovecot themselves. The downside are that it's slower for large numbers of accounts.
Just a thought…
-- sw