How to prevent bounce emails from leaving your server


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » Email » Exim

How to prevent bounce emails from leaving your serverLast Modified: Mar 9, 2015, 4:40 pm
Although this method isn't entirely correct in it's logic, as we do often want bounce messages to leave the system, if you don't, edit your /etc/system_filter.exim, and find this code:

if not first_delivery
then
   finish
endif

right *before* it, paste this code:

if $sender_address is ""
then
   if $header_Auto-Submitted: is not "auto-replied"
   then
       if ${lookup{${extract{2}{@}{$recipients}}}lsearch{/etc/virtual/domains}{yes}{no}} is "no"
       then
           noerror fail text "Delayed bounce message ignored"
           seen finish
       endif
   endif
endif



If you wish to get a copy of the dropped email, use this code instead:

if $sender_address is ""
then
   if $header_Auto-Submitted: is not "auto-replied"
   then
       if ${lookup{${extract{2}{@}{$recipients}}}lsearch{/etc/virtual/domains}{yes}{no}} is "no"
       then
           headers add "Old-Subject: $h_subject:"
           headers remove "Subject"
           headers add "Subject: [Delayed Bounce]$h_old-subject:"
           headers remove "Old-Subject"
           deliver "abuse@yourdomain.com"

           noerror fail text "Delayed bounce message ignored"
           seen finish
       endif
   endif
endif

Where you would replace abuse@yourdomain.com with the email you want.  It would be a good idea to use a local address here (that exists on this box), since if you forward it outbound, you're probably going to flag yourself for sending spam, which defeats the whole purpose of this guide.

This may help prevent backscatter, but has not been confirmed.

Referenced URL
 
Related Helpfiles
How to tell exim not to skip mail filter from <>
Warning: 200 emails have just been sent by unknown
Why forwarders to external mailservers can be dangerous for your server

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST