Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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 (Friar) 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
[ambrus]: Today I accidentally cut my hand while carrying a computer. On the display part of the motherboard that sticks out at the back of the chasis and has ports, there's this thin metal sheet with holes cut for the ports, to guide plugs into the sockets.
[ambrus]: This sheet has sharp needle-like parts, 0.004 long and less than 0.001 wide, that can get bent to point outwards, and one of these cut into my palm when I lifted the box.
[ambrus]: So now when I choose what motherboard to buy for my new home computer, I have one more specific property to guide me. Useful, because there's so many different boards to choose from.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2017-01-16 19:36 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (151 votes). Check out past polls.