The pre-made scripts are called "auto-responders". There are many available ... you see this all the time. Google® is your friend...
If you want to do it yourself, you'll probably have to be in control of the mail server for your site. Most hosting companies/ISP's are not gonna give you that kind of support, I'm guessing...unless your hosting package already includes an auto-responder, which it might...
The strategy for "rolling your own" might be: set up an alias that writes the mail to a file. Your script would run via cron, every couple minutes or so, and parse the file for details, then mail a reply. I've not done this before, but I was just playing with the mail server here, and it seems within the realm of capability. After all, how do they write auto-responders?
It might even be possible to pipe the mail directly to the program. Look for how to's on "mail writing to a pipe" or similar for Unix-like systems...list mail programs like Majordomo and Mailman do this all the time, I'm guessing....