go ahead... be a heretic | |
PerlMonks |
Email-based Content Generation Reflectorby hacker (Priest) |
on Jul 15, 2002 at 14:45 UTC ( [id://181798]=perlquestion: print w/replies, xml ) | Need Help?? |
hacker has asked for the wisdom of the Perl Monks concerning the following question:
I am working on a tool that allows a user to send an email to an address, specify a set of specific commands in the body of the message. A server process (this perl script) will receive this email, parse those commands out of the body of the message (not the Subject, these commands will be quite lengthy) and execute a wrapper script using these commands as "modifiers".
Right now, the code below works for the first test (testing for 'help' in the Subject line). I'm wondering if there's a way to do this by parsing out objects from the body, given a user's email to this address. Basically they'd send a message like: I then need to parse out the objects passed after the keys (url, depth, title, though there are about 40 possible modifiers). I can do this with split on the ':' there, and I can enforce a specific format for the email, but I'm not sure of the "right" process to actually parsing keys and values out of the body of an incoming message. Are there any modules that can help me here? I already have all the content/HTML parsing and generation code worked out, so that's not a problem. Has anyone done something like this? Are there any security/processor issues with this? This will not be executing system commands, so that isn't an issue, but it will be passing commands into a wrapper script (which already works) and operating on them through this wrapper. I need to expand this to allow parsing the keys and values passed in the body of the message. Once I have those parsed out, I need to then build a file which contains the results of this "run" of the wrapper script, tar'd up into a binary file, and sent as an attachment to the user as a reply to their original email. My code so far looks like this, and works in this very limited scope.
Back to
Seekers of Perl Wisdom
|
|