Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I create an Email Reply script?

Status
Not open for further replies.

LeonKl2

Programmer
Jun 16, 2003
26
US
I want to make a script that would, for example, if somebody emailed script@mydomain.com, it would save their name and email, and then reply to them with a message.

I know how to do all of that except on thing:
How to get the script to read the information from the message?

So far, I've managed to set up a .forward so sending an email activates the script, but how do I get the script to read who sent the email?

Thanks,
Leon
 
I'd check out formail (man formail), or just look for the From header in your script.

cat message | formail -X From\ |awk '{print $2}'

seems to do what you want. Note there are 2 spaces total between "From\" and "|awk"


 
Looks good, I'll check it out.

So is this implemented in PHP or on on the prompt?
 
formail is a console command, part of the procmail package. I don't know if PHP has an equivalent. Basically, you would just read the text and strip out what follows the "From ".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top