简体   繁体   English

Postfix +鸽舍-如何为anyuser @ anydomain接收邮件

[英]Postfix+Dovecot - How to receive mail for anyuser@anydomain

So the main idea is that I want to do something like this: 所以主要的想法是我想做这样的事情:

1) I send email to anyrandomuser@anyofmydomain.com 1)我发送电子邮件至anyrandomuser@anyofmydomain.com

2) I receive it with Dovecot, or at least store it in maildir like: /vmail/%anydomain/%anyuser 2)我通过Dovecot收到了它,或者至少将它存储在maildir中,例如:/ vmail /%anydomain /%anyuser

I tried something like this: 我尝试过这样的事情:

cat /etc/postfix/main.cf 猫/etc/postfix/main.cf

inet_interfaces = all
inet_protocols = ipv4

relay_domains = *
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

cat /etc/postfix/vmail_mailbox 猫/ etc / postfix / vmail_mailbox

@d1.com     d1.com/catchall/
@d2.com     d2.com/catchall/
@d3.com     d3.com/catchall/

So that is working pretty well. 这样就很好了。 But its limited to domain-list in /etc/postfix/vmail_mailbox and all mails endup in the same directory. 但是它仅限于/ etc / postfix / vmail_mailbox中的domain-list,所有邮件最终都位于同一目录中。 I tried to do some sorting with pcre-map like this: 我试图用pcre-map进行如下排序:

cat /etc/postfix/vmail_mailbox_pcre 猫/ etc / postfix / vmail_mailbox_pcre

/([^\@]+)@([^\s]+)/ ${2}/${1}/

But it doesnt work. 但它不起作用。 That's what i get in log: 那就是我在日志中得到的:

Jan 26 09:41:04 localhost postfix/virtual[5579]: warning: pcre map /etc/postfix/vmail_mailbox_pcre, line 1: regular expression substitution is not allowed: skipping this rule

Has anyone done something like that? 有人做过类似的事情吗? I'm open to any help. 我愿意提供任何帮助。 Thanks. 谢谢。

Receiving the mail seems to be working for you, the problem appears to be with sorting the mails depending on the recipient domain. 接收邮件似乎对您有用,问题似乎出在根据收件人域对邮件进行排序。 The dovecot sieve extension might be what you want to use the sorting. dovecot筛网扩展名可能是您要使用的排序。

The problem with your /etc/postfix/vmail_mailbox_pcre is that the regexp separator (the / ) is used more than twice, so the regexp engine gets confused. /etc/postfix/vmail_mailbox_pcre是正则表达式分隔符( / )被使用了两次以上,因此正则表达式引擎感到困惑。 Try to use some other non-alphanumeric character instead: 尝试改用其他一些非字母数字字符:

#([^\@]+)@([^\s]+)# ${2}/${1}/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM