Recipient address rejected: User unknown in local recipient table

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Recipient address rejected: User unknown in local recipient table

luckydog xf
Hi, 

 I'm new to postfix, and I use postfix + dovecot, and I add MX/A/PTR.

 I use Mariadb as Dovecot passdb and Cyrus SASL Authentication.

 And I configure email client (MUA) and try to send email to another user in the same domain, it says,

"Recipient address rejected: User unknown in local recipient table"

 I can read literally this user does not exist on this machine. How can I solve this problem? 

 I also read docs of postfix, which is quite difficult for me since I'm new to email field.

 # postconf -n
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
compatibility_level = 2
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
default_privs = nobody
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mailbox_transport = lmtp:unix:/usr/var/run/dovecot/lmtp local_recipient_maps =
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
meta_directory = /etc/postfix
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = ad.pthl.hk
myhostname = mail.ad.pthl.hk
mynetworks = 172.16.0.0/12127.0.0.0/8172.16.81.0/24
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = no
relay_domains = $mydestination
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
shlib_directory = /usr/lib/postfix
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/dovecot.pem
smtpd_tls_key_file = /etc/ssl/certs/dovecot.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
unknown_local_recipient_reject_code = 550

What  do I have to setup? I only have a single domain

Thanks,  
Reply | Threaded
Open this post in threaded view
|

Re: Recipient address rejected: User unknown in local recipient table

Noel Jones-2
On 3/29/2019 5:04 AM, luckydog xf wrote:

> Hi,
>
>   I'm new to postfix, and I use postfix + dovecot, and I add MX/A/PTR.
>
>   I use Mariadb as Dovecot passdb and Cyrus SASL Authentication.
>
>   And I configure email client (MUA) and try to send email to
> another user in the same domain, it says,
>
> "Recipient address rejected: User unknown in local recipient table"
>
>   I can read literally this user does not exist on this machine. How
> can I solve this problem?
>
>   I also read docs of postfix, which is quite difficult for me since
> I'm new to email field.

Postfix needs to know which domains it should handle, the valid
users, and what postfix should do with that mail.

It sounds like all your users are stored in dovecot and not unix
system users.  Postfix calls this a virtual mailbox domain.  Some
docs for that can be found here:
http://www.postfix.org/VIRTUAL_README.html#virtual_mailbox

Other documents can be found here:
http://www.postfix.org/documentation.html

You'll probably want something like:
mydestination = localhost  (or set this empty)
virtual_mailbox_domains = {your domain name here}
virtual_mailbox_maps = {dovecot user database here}
virtual_transport = {dovecot delivery agent here}


You may also find one of the postfix books helpful, "The Book of
Postfix" by Hildebrandt and Koetter; or  "Postfix: The Definitive
Guide" by Dent.  Both are very old and won't cover new features, but
the basic structure of postfix hasn't changed, and they're still
useful for an overview of how things work.



   -- Noel Jones
Reply | Threaded
Open this post in threaded view
|

Re: Recipient address rejected: User unknown in local recipient table

luckydog xf
I'll use Mariadb to store alias_map, uid/gid.etc 
The previous is just a quick test.
Thanks.

On Sat, Mar 30, 2019 at 4:35 PM luckydog xf <[hidden email]> wrote:
Thanks for your kindly reply. I read the book you recommended carefully and get answer.

I paste stuff as below for anyone whoever may run into this problem.
------------
## Tells Postfix to use Dovecot's LMTP instead of its own LDA to save emails to the local mailboxes.
virtual_transport = lmtp:unix:/usr/var/run/dovecot/lmtp
virtual_mailbox_domains = ad.pthl.hk  # remove $mydomain for $mydestination
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_alias_maps   = hash:/etc/postfix/virtual_alias_map
virtual_uid_maps     = static:600
virtual_gid_maps     = static:12
virtual_mailbox_base = /var/mail
it works.

And this is my personal understanding, virtual delivery agent( refer to as virtual in postfix docs)  unlike Local delivery agent ( Refer to as Local in postfix doc) does not need user exists in the postfix-running system. So it relies on virtual_mailbox_map to get  user's information and other stuff to get mail location.

Besides, postfix could use its own LMTP ,pipe, maildrop to deliver mail to mailbox, right?

Thanks a lot, you save me out of it. :),


On Sat, Mar 30, 2019 at 2:26 AM Noel Jones <[hidden email]> wrote:
On 3/29/2019 5:04 AM, luckydog xf wrote:
> Hi,
>
>   I'm new to postfix, and I use postfix + dovecot, and I add MX/A/PTR.
>
>   I use Mariadb as Dovecot passdb and Cyrus SASL Authentication.
>
>   And I configure email client (MUA) and try to send email to
> another user in the same domain, it says,
>
> "Recipient address rejected: User unknown in local recipient table"
>
>   I can read literally this user does not exist on this machine. How
> can I solve this problem?
>
>   I also read docs of postfix, which is quite difficult for me since
> I'm new to email field.

Postfix needs to know which domains it should handle, the valid
users, and what postfix should do with that mail.

It sounds like all your users are stored in dovecot and not unix
system users.  Postfix calls this a virtual mailbox domain.  Some
docs for that can be found here:
http://www.postfix.org/VIRTUAL_README.html#virtual_mailbox

Other documents can be found here:
http://www.postfix.org/documentation.html

You'll probably want something like:
mydestination = localhost  (or set this empty)
virtual_mailbox_domains = {your domain name here}
virtual_mailbox_maps = {dovecot user database here}
virtual_transport = {dovecot delivery agent here}


You may also find one of the postfix books helpful, "The Book of
Postfix" by Hildebrandt and Koetter; or  "Postfix: The Definitive
Guide" by Dent.  Both are very old and won't cover new features, but
the basic structure of postfix hasn't changed, and they're still
useful for an overview of how things work.



   -- Noel Jones