This is not really a question of 'How would I do this with Perl?', but 'How do I get the returned email message to my Perl program?'
This is completely dependant on the mail server that your Uni is using. If they are using Qmail, then you need to create a .qmail file in your homedirectory. For sendmail it would be a .forward file. If you have access to procmail, then you could use a procmail filter to do this as well.
Since I am familiar with Qmail, I'll give an example of how to use a .qmail file to execute an external program.
|/usr/local/bin/yourprogram.pl ./Maildir/
When a message comes in, it will spawn your program and send the message on STDIN. You can parse it and do what you like. If you exit with code 99 then qmail will not execute any more statements in the .qmail file. If you exit normally, qmail will continue delivery, and in this case deliver the message in the local Maidir directory.
This is exactly how Qmail's ezmlm mailing list manager handles answering incoming email messages. Similar things can be done with sendmail's .forward file format, but you will have to look it up in the man page yourself :)
Once you have the message in your perl program things become easy. I would look at the MIME-tools package which contains the MIME::Parser and MIME::Entity modules which are very handy for parsing and sending MIME compliant email messages. Don't try to parse the message yourself, let these modules do the gruntwork for you.
In reply to Re: mail-based interface for database manipulation..?
by cees
in thread mail-based interface for database manipulation..?
by kiz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |