These are instructions for setting up bounce handling for SilverStripe, and assumes you use cPanel for site managment. You should be able to mirror these steps accross to other systems also.
Here is the SilverStripe documentation on the silverstripe bounce handling:Â http://doc.silverstripe.org/doku.php?id=email_bouncehandler
- Download this file:Â BounceEmailTask.phpÂ , and store it in your SilverStripe /mysite/code/ directory. This class handles incoming emails, and determines if they are bounces, and then records the bounce accordingly. Sam Minnee from SilverStripe provided the original code, and I converted it into a SS ScheduledTask (even though its not a cron job task). More about ScheduledTasksÂ here.Â
- Set up a email@example.com email address
- Set up a cPanel filter that pipes emails that are "To: firstname.lastname@example.org" to a program:
"| php -q /home/yourusername/public_html/sapphire/cli-script.php /BounceEmailTask"
(Everything beforeÂ /sapphire/cli-script.php may differ on your hosting)
I also set another rule for the bounces to be delivered to the inbox, just incase they are needed.
- Make sure you have your site path set in your _ss_environment.php:
$_FILE_TO_URL_MAPPING['/home/yourusername/public_html'] = 'http://www.yoursite.com';
Again the site path could differ on your server.
Test by sending a newsletter, or email to an address that is very likely to bounce, eg: email@example.com
Feel free to modify the BounceEmailTask class to suit your needs.
Let me know of any problems or issues you have setting this up.