From: /dev/rob0 on
On Wed, Apr 07, 2010 at 11:19:37AM +0200, aa wrote:
> Subject: configure postfix for virtual domains

Changed to be relevant to what I think you are wanting to do.

> I configured my postfix server to use virtual domains..in
> particular I setted that all addresses that are parts of a
> particular domain won't be sent but they are archived in a
> directory on the server...

Yes, but this isn't typically what we mean when we talk about
"virtual domains".

> For example:
> in main.cf there are this rows:
>
> virtual_mailbox_domains = exampledomain1.com,
> exampledomain2.com, exampledomain3.com
> virtual_mailbox_base = /var/mail/vhosts
> virtual_mailbox_maps = hash:/etc/postfix/vmailbox
>
> and in /etc/postfix/vmailbox:
> @exampledomain1.com exampledomain1.com/
> @exampledomain2.com exampledomain2.com/
> @exampledomain3.com exampledomain3.com/
>
> It works but the question is :
>
> If I wanted to avoid that my server send mails directly but
> it archived every mail, addressed to domains different from
> exampledomainX.com, in another directory, how would I configure
> my postfix server?

This "email blackhole" idea has gotten to be a FAQ of sorts, and
whilst I have answered it a few times, I still don't understand
how/why it's useful. For a basic blackhole server:

virtual_alias_maps = static:catchall(a)catchall.mail
# the default virtual_alias_domains = $virtual_alias_maps, but
# that won't do in this case, since it would put every domain
# in virtual_alias_domains
virtual_alias_domains =

and then you'd need some means of delivering to this
"catchall(a)catchall.mail" address. Putting catchall.mail in
virtual_mailbox_domains and this in virtual_mailbox_maps:

catchall(a)catchall.mail catchall.mailbox/

is one of numerous ways to accomplish this. The virtual_alias_maps
expansion stops for that address. But read on, yours is a bit more
complex ...

> I should to create a kind of net that capture every mail not
> addressed to exampledomainX.com and archive in a particular
> folder...

virtual_alias_domains =
virtual_alias_maps = pcre:$config_directory/blackhole.pcre

blackhole.pcre:
/^(.*@exampledomain1\.com)$/ $1
/^(.*@exampledomain2\.com)$/ $1
/^(.*@exampledomain3\.com)$/ $1
/./ catchall(a)catchall.mail

And likewise, a means to deliver to catchall(a)catchall.mail.
--
Offlist mail to this address is discarded unless
"/dev/rob0" or "not-spam" is in Subject: header

 | 
Pages: 1
Prev: Have some local transport issues
Next: Mailgateway