Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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
[LanX]: Socrates was a Troll
[Your Mother]: It's very, very dangerous... Thinking that a group is intrinsically evil... buries the fact that all humans can be so deep that it starts to become likely they will be.
[Your Mother]: LanX++
[Corion]: (also the "troll for trolls sake" could seen be much like the "punk for punks beer")
[Your Mother]: I'm completely (historically anyway) a troll in real life. It's not fun online, you can't really win. :P
Happy-the-monk orders a Punk IPA.
[Your Mother]: Also, I'm too old to start fights with strangers anymore.
[LanX]: concentrating on omestic violence?
[LanX]: d
[Your Mother]: Open air violence. Or on campus.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (22)
As of 2018-03-19 13:47 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (240 votes). Check out past polls.