0

I followed this tutorial to setup an email server that uses virtual users. https://www.rosehosting.com/blog/mailserver-with-virtual-users-and-domains-using-postfix-and-dovecot-on-a-centos-6-vps/

I am able to send emails, but when i try to send an email to one of the virtual mailboxes i get the following error in the maillog.

Recipient address rejected: User unknown in virtual mailbox table;

Based on the research ive done it appears that this line is the cause. Specifically "reject_unauth_destination".

> smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated, reject_unauth_destination

I tried removing the "reject_unauth_destination" value and i then get the following error.

fatal: in parameter smtpd_relay_restrictions or smtpd_recipient_restrictions, specify at least one working instance of: reject_unauth_destination, defer_unauth_destination, reject, defer, defer_if_permit or check_relay_domains

Anyone know what i can do to fix this error. I can log into the account just fine and send mail. Everything seems fine except for this rejecting of emails.

Here is a full copy of my main.cf postfix file.

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/postfix/aliases
alias_database = $alias_maps

inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost

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

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES

relay_domains = *
virtual_alias_maps=hash:/etc/postfix/vmail_aliases
virtual_mailbox_domains=hash:/etc/postfix/vmail_domains
virtual_mailbox_maps=hash:/etc/postfix/vmail_mailbox

virtual_mailbox_base = /var/vmail
virtual_minimum_uid = 2222
virtual_transport = virtual
virtual_uid_maps = static:2222
virtual_gid_maps = static:2222

smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated

smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept
milter_protocol = 2

I have added records to the 3 vmail files to configure the account

 vmail_domains - mydomain.com OK
 vmail_mailbox - dan@mydomain.com mydomain.com/dan/
 vmail_aliases - dan@mydomain.com dan@mydomain.com
5
  • you populated virtual_mailbox_domains(using your domain) and virtual_mailbox_maps(your user mail) and after postmap and restart or reload postfix? – c4f4t0r Dec 9 '15 at 13:30
  • i have added a section that shows what i have added to vmail_comains, mailbox and aliases for the email account im currently trying to setup – Dan Hastings Dec 9 '15 at 13:46
  • 1
    the error is very clear, did you used postmap? try postmap -q dan@mydomain.com hash:/etc/postfix/vmail_mailbox – c4f4t0r Dec 9 '15 at 14:02
  • the email is already in the vmail_mailbox file and i ran postmap too. When i ran it using the command listed i got the following error. Maybe the DB isnt getting corretly updated? postmap: warning: database /etc/postfix/vmail_mailbox.db is older than source file /etc/postfix/vmail_mailbox Looking at the timestamp i can see that vmail_mailbox.db hasnt been updated in over a month. It seems postmap isnt writing to this db anymore – Dan Hastings Dec 9 '15 at 14:05
  • 1
    use postmap /etc/postfix/vmail_mailbox and service postfix restart and try again – c4f4t0r Dec 9 '15 at 14:18
0

the error is very clear, did you used postmap? try postmap -q dan@mydomain.com hash:/etc/postfix/vmail_mailbox.

for solving your problem you need to use "postmap /etc/postfix/vmail_mailbox and service postfix"

If you are using hash table in postfix, every time you change the text file you need to use postmap on the files to regenerate the db files.

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.