Se o MTA obedecer a um arquivo ~ / .forward, você poderá ter o procmail processando o e-mail recebido e executando um script assim que como a mensagem chega.
Veja o link
Para uma das minhas contas, tenho o seguinte ~ / .procmailrc
# procmail tutorial: http://tldp.org/LDP/LG/issue14/procmail.html
PATH=/usr/local/bin:/bin:/usr/bin
MAILDIR=$HOME/Mail
DEFAULT=$HOME/Mail/inbox
LOGFILE=$HOME/procmail.'date +%Y-%m'.log
SHELL=/usr/bin/ksh
MY_XLOOP='X-Loop: [email protected]'
MY_RECIPIENT='[email protected]'
#############################################################################
# 3rd party request processing
# send a copy of the message to the processing script, and carry on
# with the next recipe
:0c
* ^From:.*@3rdparty\.invalid
* ^Subject:.*ABC/DEF.*(Request|Access|Approval)
| $HOME/bin/process_request_email.pl | \
mailx -s "3rd party request results" $MY_RECIPIENT
#############################################################################
# forward all mail to mailing list
:0
* ! ^$MY_XLOOP
{
# add a header
# 'f' = filter: continue processing results of program
# 'w' = wait for program to return
# 'h' = pass message headers to program
:0fwh
| formail -A "$MY_XLOOP"
# then forward the message
# 'c' = send a copy to recipient and continue processing
:0c
! $MY_RECIPIENT
}
# if we get here, then the message has an X-Loop header.
# let it fall into $DEFAULT