jandafields Posted May 8, 2004 Posted May 8, 2004 I have the default address of my domain sent to myself, so if someone sends an email to mnsdlksdf@****, I still get it. That works great. This also means that the email server should never be able to bounce a message back to the sender from my domain (unless my email is full). However, I have a filter that sends emails with subject "bouncetest" (without the quotes) to a script that then sends the email back to the sender as undelieverable. If I send a message to a real account with subject bouncetest, my script works fine and it bounces back like it should. Here is the problem: If I send a message to a nonexisting account with subject bounctest, my script works fine and it bounces like it should. HOWEVER, the message is also actually bounced from the email server. So, I get 2 bounced messages. One from the script and one generated by the email server. This should not happen because of my first sentence of this post. There should still only be one bounce returned to the sender. The server is not trying to delivery this to the nonexisting address anyway. It gets deleted after the script runs without delivery to anyone regardless of whether the user actually exists or not anyway Any ideas? I don't want to use fail or blackhole as the default address. I just want to bounce certain messages. Here is the bounced message from the email server (not my script), however my bounce script does run correctly as well: >This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: pipe to |/home/****/public_html/cgi-bin/bounce.php generated by blabla@*****.com The following text was generated during the delivery attempt: ------ pipe to |/home/****/public_html/cgi-bin/bounce.php generated by blabla@*****.com ------ Content-type: text/html X-Powered-By: PHP/4.3.3 Quote
jandafields Posted May 9, 2004 Author Posted May 9, 2004 In case anyone else ever runs across this problem, here is the solution: Run php in quiet mode -q. Otherwise, it returns: Content-type: text/html X-Powered-By: PHP/4.3.3 And the email server feels inclided to return that as an error. Also, NO BLANK LINES between #!/usr/bin/php -q and <?php Quote
LisaJill Posted May 9, 2004 Posted May 9, 2004 You got it worked out? Fantastic! This one was definitely way outside my own area of knowledge. I'm going to move this to a better forum so that it may be more easily found for others in this situation. Thank you for following it up! Quote
jandafields Posted May 9, 2004 Author Posted May 9, 2004 I try to always follow up when I get a solution. There have been so many times when I search a forum and find someone with my exact same problem and they either get it working and don't reply and all, or simply say "it's fixed now." That doesn't do anybody else any good. I get sooo much help here on this (TCH) forums. You all are great! Quote
jandafields Posted May 9, 2004 Author Posted May 9, 2004 You know, using a filter to send email to a php script can be extremely useful and powerful. This gives you the ability to make filters with multiple criteria. CPanel filters let you do this: >If subject = "billing" THEN forward to billing@domain.com PHP scripts let you do this: >If subject = "billing" or "sales" AND to = support@domain.com AND body contains account number THEN save email to database AND send a copy to admin@domain.com AND send personalized reply to sender. Although that example is probably useless, you can see the complexity that it allows. Who knows... it may be valuable to someone other than me. Quote
TCH-Don Posted May 10, 2004 Posted May 10, 2004 Thank you for the follow up and the examples. Thumbs Up As you say this will help some else, and the clear topic heading will make it very seachable. Quote
hruska Posted May 18, 2004 Posted May 18, 2004 Does the email filter apply BEFORE spamassassin, or AFTER? In other words, could it be used to do much fancier whitelisting than spamassassin allows? Or would it bypass spamassassin completely in this case? Quote
jandafields Posted May 18, 2004 Author Posted May 18, 2004 spamassassin adds it's header to the email, and then it goes to the filter. Spamassassin first Filters second So your filter could read the headers added by spamassassin and then do with the email whatever you want it to. Allow it to go through, delete it, bounce it, send it somewhere else, whatever. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.