htmanning has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
A long time ago I had a procmail script that was able to receive an email, parse it, and call a perl script with variables. I'm searching like crazy and can't find a way to do this. Can someone point me in the right direction?
I'd like to be able to send an email to a specific address, take the subject and body of the email, pass it to a perl script which will update a database and send out an email notification.
Possible?
Thanks.
Re: Call Perl via email
by gnosti (Chaplain) on Aug 04, 2011 at 08:07 UTC
|
Here is a way to do it without procmail using Email::Filter and a sendmail interface such as Email::Sender.
In ~/.forward
| filter_mail
In ~/bin/filter_mail
use Email::Filter;
my $mail = Email::Filter->new(emergency => "~/emergency_mbox");
$mail->accept("$ENV{HOME}/Mail/new") unless $mail->subject =~ /magic_k
+eyword/; # usually exit here
send_mail();
sub send_mail {
# see docs for Email::Sender
}
| [reply] [d/l] [select] |
Re: Call Perl via email
by thewebsi (Scribe) on Aug 04, 2011 at 05:33 UTC
|
I wonder if this is more of a Procmail question than Perl... I do that through Postfix, in a file called /etc/postfix/master.cf. It automatically parses out any header fields I want, and passes it to any script. Procmail instructions are here.
| [reply] |
Re: Call Perl via email
by JavaFan (Canon) on Aug 04, 2011 at 09:04 UTC
|
That's not a Perl question, it's procmail question. The answer lies in the procmailrc manual page, section Recipe action line. | [reply] [d/l] [select] |
Re: Call Perl via email
by davido (Cardinal) on Aug 04, 2011 at 04:36 UTC
|
Do you still have access to procmail? What is your incoming mail handler? Or are you thinking of something that would sit between Outlook and some pop3 account?
We would need to know where the hooks are before a solution can be suggested, and that will depend on what currently handles your incoming mail.
| [reply] |
|
This would be on an apache server hosted at Pair Networks. I believe I could use Procmail, but I'm not tied to that.
| [reply] |