Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Modules to check new mails

by lakshmananindia (Chaplain)
on Feb 10, 2009 at 04:09 UTC ( #742649=perlquestion: print w/replies, xml ) Need Help??
lakshmananindia has asked for the wisdom of the Perl Monks concerning the following question:

Hai monks,

I know Net::SMTP will send mail. But is there any way in Perl to check whether a new mail arrived? If arrived I need to take the subject and the sender of the mail.

Is it possible? If yes, Please explain how?

Replies are listed 'Best First'.
Re: Modules to check new mails
by weismat (Friar) on Feb 10, 2009 at 04:25 UTC
Re: Modules to check new mails
by Corion (Pope) on Feb 10, 2009 at 07:21 UTC

    Personally, I've grown fond of decoupling the storing of arriving mail and actions upon mail. I use IMAP stores to store mail and use Net::IMAP::Client to process the mails after having received them. This means that I cannot immediately reject spam but have to temporarily store it.

    If you want to process mail immediately after it receives, also look into Mail::Action, which provides a framework for actions triggered by arriving mail and some documentation on how to set up your mail server to use it.

Re: Modules to check new mails
by gnosti (Hermit) on Feb 10, 2009 at 05:30 UTC
    You don't mention your operating system, or how the mail is normally delivered. I run (as a cron job) a script combining Net::POP3, which gets the mail, and Email::Filter, which I use to sort and log incoming mail. Email::Filter provides access to the header fields. You might also put a script with Email::Filter into your .forward file.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://742649]
Approved by planetscape
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2018-05-23 23:00 GMT
Find Nodes?
    Voting Booth?