The below catches all incoming as well as outgoing messages for a domain.
PHP Code:
if first_delivery
and ("$h_to:, $h_cc:" contains "@domain.com")
or ("$h_from:" contains "@domain.com")
then
unseen deliver "all-catcher@domain.com"
endif
For just catching all incoming use the following:
PHP Code:
if first_delivery
and ("$h_to:, $h_cc:" contains "@domain.com")
then
unseen deliver "incoming-catcher@domain.com"
endif
Similarly for catching only all outgoing
PHP Code:
if first_delivery
and ("$h_from:" contains "@domain.com")
then
unseen deliver "outgoing-catcher@domain.com"
endif