Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Reading email on Exchange

by peschkaj (Pilgrim)
on Jul 24, 2003 at 18:30 UTC ( [id://277624]=note: print w/replies, xml ) Need Help??


in reply to Reading email on Exchange

You can indeed use the Net::POP3 module to take care of reading email on exchange.

One thing to keep in mind while reading the email is that the retrieve command (RETR MSG_NUM, $pop->get(MSG_NUM) in perl) will remove the message from the server. In order to get the full text of the message from exchange without removing the message from the server, you will want to send a TOP command with the NUMLINES parameter set to 0.

Example:

use Net::POP3; my $pop = Net::POP3->new( "mail.mydomain.com", Timeout => 60 ); $pop->user( "me" ); $pop->pass( "mypass" ); ### or you can use ### $pop->login( "me", "mypass" ); ### or if your server supports it: ### $pop->apop( "me, "mypass" ); $pop->popstat(); # returns number of messages # and total size in bytes $pop->list(); # returns number of messages, # total size in bytes, # and byte size for each message $pop->top( 1, 0 ); # shows the contents # of the first message # in the mailbox ### you might want to run NOOP every once in a while ### if you want to keep the connection alive ### refer to: http://www.faqs.org/rfcs/rfc1939.html ### for a more detailed explanation if needed.

Hope that helps.

If you make something idiot-proof, eventually someone will make a better idiot.

I am that better idiot.

Replies are listed 'Best First'.
Re: Re: Reading email on Exchange
by qadwjoh (Scribe) on Jul 24, 2003 at 19:02 UTC
    OK.

    I tried peschkaj's method and got it to work.

    Now any ideas on how to select an email from someone and save the attachement on it?

    thanks,
    A
      Have a look at the Mime::Tools module. That will allow you to parse a multipart email, and save the attachment.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://277624]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-23 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found