using same script in email handling and POST web form

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Hi All, I have a script sitting on my web server called
auto_mail.php5. I would like this to be used two different ways.

One way would be for a web form to call it as submit action on a form.
I have got this working great.

However, to get this to work I had to comment out the first line of
the script which is #!/usr/bin/php -q

Now the other way the script is called doesn't work any more! This
other way is that when receives an email it
forwards the email to |/home/beckhall/public_html/php/auto_mail.php5

Since I removed that first line the forwarder never invokes the
script! If I put the first line back in then the forwarder works but
the web post does not. This is because the web post later does a
HEADER("newurl") to do a redirect, and this fails as text has already
been posted to the form. catch-22!

Any suggestions? I would guess but I'm no expert that the best
solution would be to tell the email forwarded to use php to process
the auto_mail.php5, but I don't know how to do this! Maybe the
forwarder to go to another script, that then calls auto_mail.php5?

Cheers for any help,


Site Timeline