[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Simple IMAP client?

Phil Rhoades

9/2/2008 12:20:00 PM

People,

I am thinking about writing a very simple IMAP client in Ruby (mostly
for access from mobile phones) - anyone done anything like this?
Suggestions?

Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: phil@pricom.com.au

3 Answers

Anthony Pearson

9/2/2008 2:43:00 PM

0

The documentation for net/imap is pretty decent for figuring out what
you want to do... Here is a piece of code from my original script that
could get you started in the right direction.

require 'net/imap'

imap = Net::IMAP.new(server)
imap.login(user, pass)
imap.examine('INBOX')
smtp = Net::SMTP.new(srvr, 25)
imap.search(["UNSEEN"]).each do |message_id|
envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
from = "#{envelope.from[0].mailbox}@#{envelope.from[0].host}"
subj = envelope.subject
end
imap.logout


On Tue, Sep 2, 2008 at 7:20 AM, Phil <phil@pricom.com.au> wrote:
> People,
>
> I am thinking about writing a very simple IMAP client in Ruby (mostly for
> access from mobile phones) - anyone done anything like this? Suggestions?
>
> Thanks,
>
> Phil.
> --
> Philip Rhoades
>
> GPO Box 3411
> Sydney NSW 2001
> Australia
> E-mail: phil@pricom.com.au
>
>

Phil Rhoades

9/3/2008 4:28:00 AM

0

Anthony,

Thanks for that, I'll give it a go!

Regards,

Phil.


Anthony Pearson wrote:
> The documentation for net/imap is pretty decent for figuring out what
> you want to do... Here is a piece of code from my original script that
> could get you started in the right direction.
>
> require 'net/imap'
>
> imap = Net::IMAP.new(server)
> imap.login(user, pass)
> imap.examine('INBOX')
> smtp = Net::SMTP.new(srvr, 25)
> imap.search(["UNSEEN"]).each do |message_id|
> envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
> from = "#{envelope.from[0].mailbox}@#{envelope.from[0].host}"
> subj = envelope.subject
> end
> imap.logout
>
>
> On Tue, Sep 2, 2008 at 7:20 AM, Phil <phil@pricom.com.au> wrote:
>> People,
>>
>> I am thinking about writing a very simple IMAP client in Ruby (mostly for
>> access from mobile phones) - anyone done anything like this? Suggestions?
>>
>> Thanks,
>>
>> Phil.
>> --
>> Philip Rhoades
>>
>> GPO Box 3411
>> Sydney NSW 2001
>> Australia
>> E-mail: phil@pricom.com.au
>>
>>
>

--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: phil@pricom.com.au

Phil Rhoades

9/3/2008 5:06:00 PM

0

People,

I have made some progress with this and can look at mails (headers, body
etc) but imap.store for changing flags has no affect and I don't get any
errors . .

Suggestions?

Thanks,

Phil.


Anthony Pearson wrote:
> The documentation for net/imap is pretty decent for figuring out what
> you want to do... Here is a piece of code from my original script that
> could get you started in the right direction.
>
> require 'net/imap'
>
> imap = Net::IMAP.new(server)
> imap.login(user, pass)
> imap.examine('INBOX')
> smtp = Net::SMTP.new(srvr, 25)
> imap.search(["UNSEEN"]).each do |message_id|
> envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
> from = "#{envelope.from[0].mailbox}@#{envelope.from[0].host}"
> subj = envelope.subject
> end
> imap.logout
>
>
> On Tue, Sep 2, 2008 at 7:20 AM, Phil <phil@pricom.com.au> wrote:
>> People,
>>
>> I am thinking about writing a very simple IMAP client in Ruby (mostly for
>> access from mobile phones) - anyone done anything like this? Suggestions?
>>
>> Thanks,
>>
>> Phil.
>> --
>> Philip Rhoades
>>
>> GPO Box 3411
>> Sydney NSW 2001
>> Australia
>> E-mail: phil@pricom.com.au
>>
>>
>

--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: phil@pricom.com.au