Filtering "Mail delivery failed : returning message to sender" emails

monkey64

Well-Known Member
Nov 6, 2011
103
4
68
cPanel Access Level
Root Administrator
I am receiving lots of "Mail delivery failed : returning message to sender" emails which are being sent to "[email protected]". WHM currently forwards mail for root to my own email address. I'd rather not receive this emails so I thought I would set up filtering to stop them coming through to my mailbox.

I set up a Global Email Filter as well as an Email Filter on my email account, neither of which had any effect. The Filter Trace Results section did apparently match the condition though:

Code:
The Filter has matched the following condition(s):

    $header_subject: contains Mail delivery failed : returning message to sender

Return-path copied from sender
Sender      = [email protected]
Recipient   = [email protected]
Testing Exim filter file "/etc/vfilters/server.com"

Headers charset "UTF-8"
Save message to: /dev/null 0660
Filtering set up at least one significant delivery or other action.
No other deliveries will occur.
Then I tried creating an Exim Filter at /usr/local/cpanel/etc/exim/sysfilter/options/

Code:
# Mail delivery failed: returning message to sender
if $header_subject: contains "Mail delivery failed: returning message to sender"
then fail
endif
Code:
# Warning: message 123456789 delayed 72 hours
if $header_subject: contains "Warning: message" and $header_subject: contains "delayed"
then fail
endif
I went to the Exim Configuration Manager, enabled the filter and restarted EXIM but that hasn't worked either because the emails still come through. Can anyone help?

Thanks
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,250
313
Houston
I'd first be concerned why you're getting so many of these, they're indicative of a problem and resolving the underlying issue will resolve the symptom of receiving the bounce messages.