# procmail with more then one domain

## elmar283

I have a mailserver for some years now. It is working great, except for the procmail part of my virtual domains.

I used this manual: https://wiki.gentoo.org/wiki/Complete_Virtual_Mail_Server

In postfix I have mailbox_command = /usr/bin/procmail -a "elmarotter.eu"

I would like that command also to filter the other domains. 

The virtual domains are located at /var/vmail/<virtual_domain>/<user>

Does anyone knows how to do this?

Here are some config files, if you need more let me know:

```

egrep -v '^(\#|$)' /etc/postfix/main.cf

compatibility_level = 2

queue_directory = /var/spool/postfix

command_directory = /usr/sbin

daemon_directory = //usr/libexec/postfix

data_directory = /var/lib/postfix

mail_owner = postfix

myhostname = elmarotter.eu

mydomain = elmarotter.eu

myorigin = elmarotter.eu

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

unknown_local_recipient_reject_code = 450

mynetworks = 10.0.0.0/24 192.168.0.0/24, 192.168.178.0/24, 127.0.0.0/8

home_mailbox = .maildir/

local_destination_concurrency_limit = 2

default_destination_concurrency_limit = 20

debug_peer_level = 5

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

newaliases_path = /usr/bin/newaliases

mailq_path = /usr/bin/mailq

setgid_group = postdrop

html_directory = no

manpage_directory = /usr/share/man

sample_directory = /etc/postfix

readme_directory = no

home_mailbox = .maildir/

inet_protocols=ipv4

message_size_limit = 20971520

alias_maps = mysql:/etc/postfix/mysql-aliases.cf

relocated_maps = mysql:/etc/postfix/mysql-relocated.cf

local_transport = local

local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname

virtual_transport = virtual

virtual_mailbox_domains = elmarotter.nl, henkotter.nl, ketellapper.eu

virtual_minimum_uid = 5000

virtual_gid_maps = static:5000

virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf

virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf

virtual_uid_maps = static:5000

virtual_mailbox_base = /

virtual_mailbox_limit = 0

owner_request_special = no

recipient_delimiter = +

broken_sasl_auth_clients = no

smtpd_sasl_auth_enable = yes

smtpd_sasl_security_options = noanonymous

smtpd_sasl_local_domain =

smtpd_sasl_authenticated_header = no

smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination

smtpd_tls_security_level = may

smtp_tls_CApath = /etc/ssl/certs

smtpd_tls_auth_only = no

smtpd_tls_loglevel = 3

smtpd_tls_key_file = /etc/ssl/postfix/elmarotter.eu_privatekey.pem

smtpd_tls_cert_file = /etc/ssl/postfix/elmarotter.eu_crt.pem

smtpd_tls_CAfile = /etc/ssl/certs/cacert.org_root.pem 

smtpd_tls_received_header = yes

smtpd_tls_session_cache_timeout = 3600s

tls_random_source = dev:/dev/urandom

biff = no

empty_address_recipient = MAILER-DAEMON

queue_minfree = 120000000

smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net

smtpd_helo_restrictions = permit_sasl_authenticated, reject_invalid_hostname, reject_non_fqdn_hostname

smtpd_helo_required = yes

disable_vrfy_command = yes

smtpd_banner = $myhostname ESMTP NO UCE

mailbox_command = /usr/bin/procmail -a "elmarotter.eu"

meta_directory = /etc/postfix

shlib_directory = /usr/lib/postfix/${mail_version}

smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache

smtp_tls_security_level = may

smtp_tls_loglevel = 1
```

```

egrep -v '^(\#|$)' /etc/postfix/master.cf

smtp      inet  n       -       n       -       -       smtpd -D

submission inet n       -       n       -       -       smtpd

smtps     inet  n       -       n       -       -       smtpd -o smtpd_tls_wrappermode=yes

pickup    unix  n       -       n       60      1       pickup

cleanup   unix  n       -       n       -       0       cleanup

qmgr      unix  n       -       n       300     1       qmgr

tlsmgr    unix  -       -       n       1000?   1       tlsmgr

rewrite   unix  -       -       n       -       -       trivial-rewrite

bounce    unix  -       -       n       -       0       bounce

defer     unix  -       -       n       -       0       bounce

trace     unix  -       -       n       -       0       bounce

verify    unix  -       -       n       -       1       verify

flush     unix  n       -       n       1000?   0       flush

proxymap  unix  -       -       n       -       -       proxymap

proxywrite unix -       -       n       -       1       proxymap

smtp      unix  -       -       n       -       -       smtp

relay     unix  -       -       n       -       -       smtp

showq     unix  n       -       n       -       -       showq

error     unix  -       -       n       -       -       error

retry     unix  -       -       n       -       -       error

discard   unix  -       -       n       -       -       discard

local     unix  -       n       n       -       -       local

virtual   unix  -       n       n       -       -       virtual

lmtp      unix  -       -       n       -       -       lmtp

anvil     unix  -       -       n       -       1       anvil

scache    unix  -       -       n       -       1       scache

localhost:10025 inet n  -       n       -       2       smtpd

  -o disable_dns_lookup=yes

  -o content_filter=

  -o myhostname=zaphodbeeblebrox.elmarotter.eu

  -o local_recipient_maps=

  -o relay_recipient_maps=

  -o smtpd_restriction_classes=

  -o smtpd_client_restrictions=

  -o smtpd_helo_restrictions=

  -o smtpd_sender_restrictions=

  -o smtpd_recipient_restrictions=permit_mynetworks,reject

  -o mynetworks=127.0.0.0/8

  -o strict_rfc821_envelopes=yes

  -o smtpd_error_sleep_time=0

  -o smtpd_soft_error_limit=1001

  -o smtpd_hard_error_limit=1000

  -o smtpd_client_connection_count_limit=0

  -o smtpd_client_connection_rate_limit=0

  -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks

  -o smtpd_authorized_xforward_hosts=127.0.0.0/8

amavis    unix  -       -       n       -       2       lmtp

  -o disable_dns_lookups=yes

  -o lmtp_send_xforward_command=yes

  -o lmtp_data_done_timeout=1200  

smtp       inet  n       -       n       -       2       smtpd

  -o content_filter=amavis:[127.0.0.1]:10024

  -o receive_override_options=no_address_mappings

smtps     inet  n       -       n       -       2       smtpd

  -o smtpd_tls_wrappermode=yes

  -o content_filter=amavis:[127.0.0.1]:10024

  -o receive_override_options=no_address_mappings
```

----------

## gerdesj

According to this: https://en.wikipedia.org/wiki/Procmail procmail is no longer supported by the author, so you might want to look into Sieve or maildrop instead.

That said, this page http://standish.home3.org/virtual-procmail descibes an approach involving multiple domains and this: http://www.postfix.org/VIRTUAL_README.html

A search for "procmail multiple domains postfix" turns up a lot of useful clues ...

----------

