Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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!

Posted

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!

Posted

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.

Posted

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.

  • 2 weeks later...
Posted

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?

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...