Pipe bounced email!
Well I was working on this all day yesterday and I finally got it to work!
Lets say you are sending out a newsletter or something to people in your DB. Chances are you are going to get some bounces. Now, why would you do nothing with these bounced emails? You should unsubscribe them from your DB or something! Here's how to do it:
Step 1: Make a php file and call it whatever you want.
Step 2: Paste the following code into it:
Step 4: In cpanel, go to "Account Level Filtering", click Create New Filter.
Name it whatever you like, then set up how you want them filtered. I set it up as "Subject Equals: Mail delivery failed: returning message to sender"
Step 5: Under Actions, click pipe to program, and put this:
Step 6: Testing and fixing! There is only one problem with the code above, on line 26 you see 2 numerical values.. This is what deletes extra characters from the substring. When you change the start and ending limiters to fir your needs, the numbers will be off. Just play around with the numbers until you get no extra characters (or any accidentally deleted characters) at the end or beginning of the email!
Step 7: Save everything! It will now be working. Please note that "testing" the filter does not work correctly, and nothing will happen why you try to do so. If you really want to test it, send an email to your main account with the title filter you chose and the same body as a bounced email and see if it works! Also, there may be a better way to strip the email out of the email, so be my guest to change it and let me know! You might be able to pass a header when you're sending your emails to make your life a little easier.
Thanks would be appreciated :D Please let me know of any customization to this script that make it easier to use! :)
Bumping this! :3
It should be noted that this will only work on linux where email piping is available. On windows it is not possible to use piping.
|All times are GMT +1. The time now is 05:35 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.