Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Call Perl via email

by htmanning (Pilgrim)
on Aug 04, 2011 at 01:26 UTC ( #918413=perlquestion: print w/replies, xml ) Need Help??
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.

Replies are listed 'Best First'.
Re: Call Perl via email
by gnosti (Hermit) 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 }
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/ It automatically parses out any header fields I want, and passes it to any script. Procmail instructions are here.

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.
Re: Call Perl via email
by davido (Archbishop) 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.


      This would be on an apache server hosted at Pair Networks. I believe I could use Procmail, but I'm not tied to that.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://918413]
Approved by muba
Front-paged by ww
NodeReaper hides the Vote Fairy's wand

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2018-03-25 00:34 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (299 votes). Check out past polls.