Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've just setup my first virtual mailbox in Postfix. I wonder if it is possible to have two mailboxes on the same server, one virtual and one with shell account, within the same domain?

first@mydomain.com => goes to /home/first/..
second@mydomain.com => goes to /var/spool/mail/virtual/..

What I need is to forward emails using .forward file and it is possible only for shell accounts and not virtual mailboxes. So I need to have both types of mailboxes, one to store and one to forward.

The problem I have is that when I add mydomain.com to mydestination list, no email is saved within virtual mailboxes. And ThunderBird prompts:

An error occurred while sending mail. The mail server responded:  5.1.1 <second@mydomain.com>: Recipient address rejected: User unknown in local recipient table. Please check the message recipient second@mydomain.com and try again.


Here's what I've done so far without success:

My /etc/postfix/main.cf:

mydestination = localhost
virtual_mailbox_domains = mydomain.com
virtual_alias_maps = hash:/etc/postfix/valias
virtual_mailbox_base = /var/spool/mail/virtual
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 100
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

My /etc/postfix/valias:

shell_account shell_account@localhost

My /etc/postfix/vmailbox:

virtual@mydomain.com mydomain.com/virtual/

And then I've run postmap /etc/postfix/valias, postmap /etc/postfix/vmailbox and finally postfix reload. And since I'm using Courier as for IMAP server, userdb -show shows:


But when I try to send an email to shell_account@mydomain.com, Thunderbird prompts:

An error occurred while sending mail. The mail server responded:  5.1.1 <shell_account@mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table. Please check the message recipient shell_account@mydomain.com and try again.


And here's my mail.log:

postfix/smtpd[10098]: connect from localhost[]
postfix/smtpd[10098]: NOQUEUE: reject: RCPT from localhost[]: 550 5.1.1 <shell_account@mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<mehran@localhost> to=<shell_account@mydomain.com> proto=ESMTP helo=<[]>
postfix/smtpd[10098]: disconnect from localhost[]
share|improve this question

closed as off-topic by Jenny D, mdpc, Jacob, Tom O'Connor May 13 '14 at 14:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Jenny D, Jacob, Tom O'Connor
If this question can be reworded to fit the rules in the help center, please edit the question.

Yes. Read the docs at postfix.org. –  Jenny D May 11 '14 at 11:58
I'm not saying that I've read it completely. But I'm not a foreigner to it either. The problem is that when I put mydomain.com in mydestination, then no email is stored in virtual mailboxes ending with mydomain.com! A pointer to the right direction is greatly appreciated. –  Mehran May 11 '14 at 12:16

1 Answer 1

up vote 1 down vote accepted

Well, I don't know this satisfied your need or not. Suppose

mydestination = local.mydomain.com
virtual_mailbox_domains = mydomain.com

Then add the alias on your virtual_alias_maps

virtual_alias_maps = hash:/etc/postfix/virtual_alias

Content of /etc/postfix/virtual_alias (updated)

second@domain.com second

The idea is generate alias from your virtual_mailbox domains to local domain because .forward only works on local domain.

References: postfix.org

share|improve this answer
Thanks for the suggestion but it didn't work. I've updated the question, would you please take a look at it? –  Mehran May 12 '14 at 7:32
What's the error says in maillog file? –  masegaloeh May 12 '14 at 7:40
I've updated the question with logs. –  Mehran May 12 '14 at 8:42
I found the problem, I needed to write first@mydomain.com first in virtual_alias. Thanks. –  Mehran May 12 '14 at 10:25

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