How to add info to MySQL when an email arrives?

I want that everytime that someone sends an email to problems@mydomain.com to run some kind os script that put the info of that info in a table and resond to the sender sending a Case ID number, How can I do this?

I know that I can edit the aliases file to run an script when an emails is received to an spaceific address but I dont know how to get the info of that sender and reply him.
matrix717Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VGRCommented:
classical question. PHP can't do this alone. PHP can't react to SMTP events. You've to use a twisted version of the sendmaild (queing, etc).

On *nix it's rather easy.

On Windows I did not find the way yet 8-)
0
bobsledbobCommented:
VGR is mostly right.  Using PHP for this doesn't seem right.  However, if you have a CLI (command-line) or CGI version of PHP, then you in theory could use PHP to do this.  If you do have this, then simply writing a script like this should work:

#!/path/to/php -q  // -q for CGI version, not for CLI version
<?php
  // do some magic here, like checking for environment
  // variables set by mail program.
?>

Of course, you're going to have to check for the environment that sendmail sets up, since this will contain the header and body of your email message.

Overall, you're barking up the wrong tree.  PHP is not the solution for you.  There's plenty of open-source off-the-shelf solutions that will do this for both *nix and windows.

Adam
0
VGRCommented:
could you name a single one free (and good :D ) for Windows and (if possible) cross-portable to linux ?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

bobsledbobCommented:
Search for "Microsoft Exchange Server Scripting Routing" on google.

http://www.google.com/search?q=Microsoft+Exchange+Server+Scripting+Routing

=)

At least that's a start.  I think you're dreaming for 'cross-portable' though. ;)
0
matrix717Author Commented:
I need one for Unix...
0
VGRCommented:
for unix, the sendmail most encountered is enough. Look in its options. It's able to invoke php (as CGI-Bin : php -commandline) upon receiving an email to specific addresses
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bobsledbobCommented:

Also, I was thinking last night, you might want to use 'procmail' to help you out.  It's 99% of the time bundled with sendmail, so you should likely have it.  Do a 'man procmail' to read about it.

Basically, you can set up procmail rules to help process incoming email.  Then, you can make logical decisions on what to do and can alliviate some of the problems you're going to have with parsing the email, passing the parameters off to some program, etc.

There's got to be a perl program that does what you're looking for.  A quick search through CPAN should get you there.

I think between my advice and VGR's, your question is basically answered.

Hope this helps.

Adam
0
prady_21Commented:
if i have not mistaken you, you want to respond to a mail, the mails coming at you@somedomain.com
Well as you said, you can do it by aliasing and running a script. I did this in perl, so i dont know if that helps??????
The shell gives the contents of the mail to the script, so the script can read the contents and get the From: address of the user, and then you can reply back to the person.
So if you need any help, see the book Sendmail by O'Reilly, if you can do it in perl, it is easy
Hope this helped you



0
snoyes_jwCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Split: VGR {http:#8168321} & bobsledbob {http:#8168614}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

snoyes_jw
EE Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.