0

I can’t figure out how to forward mail withhPostfix and Dovecot to a specific Mailbox.

Sender Mail Address --> Mailbox of Receiver

At moment the mails are transfered into the INBOX of specific Users.

Postfix configuration:

Main.cf

lmtp_destination_recipient_limit = 1
mailbox_transport = lmtp:unix:private/dovecot-lmtp
virtual_alias_maps = hash:/etc/postfix/_virtual
virtual_mailbox_base = /var/vmail
virtual_uid_maps = static:10000

Virtual_alias_maps

@sender.org                        user@receiver.org

Dovecot:

mail_location = maildir:~/Maildir
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix =
  separator = /
  type = private
}
protocols = imap imap lmtp
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-userdb {
    group = vmail
    mode = 0600
    user = vmail
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0666
    user = postfix
  }
}
Dave M
  • 4,514
  • 22
  • 31
  • 30

2 Answers2

0

The virtual_alias_maps command is designed to redirect an incoming message by recipient, not by sender, so yours would suggest user@recipient as a catchall address for mails directed to *@sender. Note that the file name must be the same as specified in main.cf, so /etc/postfix/_virtual in your case and you need to call postmap after every update.

If you want to reroute an incoming mail based on the sender address, you could try the following:

In main.cf modify the option smtpd_recipient_restrictions so that it contains check_sender_access hash:/etc/postfix/sender_access Then create /etc/postfix/sender_access with a content like

sender.org REDIRECT user@receiver.org

(See the postfix manual entry of Access(5) for details on the file syntax.)

After that, run postmap /etc/postfix/sender_access, reload/restart your postfix and from now on, all incoming mail from the domain sender.org should be delivered to user@receiver.org, regardless of the TO, CC and BCC field.

Burnus
  • 166
  • 8
0

thanks for the answer. You are right. Its the recipient not the sender.

Let me clarify my question.

How can I realise the following constalation?

Mail -> recipient address -> mail account account -> specific Mailbox