Dhaval Parikh wrote:
Hello frnds
Is there a method of retrieving mails using POP? Pls send refrences for
the same.
Thanks
Dhaval Parikh
Really, did you even try to do a search for ruby and POP on Google?? If something is not working from the first hit that you get on Google when you search for Ruby POP, will you tell us what errors you are getting.
I know I'm going to get flamed (again) about pointing this out, but please at least do some basic level of search before asking the group here.
Anyway, I've done the work for you. Please look at:
http://www.ruby-doc.org/stdlib/libdoc/net/pop/rdoc/classes/Net/POP3.html
http://www.google.com.sg/search?hl=en&q=ruby+pop3+&btnG=Search&meta=
Cheers,
Mohit.
11/18/2007 | 12:11 AM.
> Is there a method of retrieving mails using POP? Pls send refrences for
> > the same.
If your mail is on Gmail (that uses ssl), the gmailer lib will make
your life easier :
gmailer :
http://rubyforge.org/projects/gmailutils
http://rubyforge.org/docman/view.php/869/194/README
Example :
require 'rubygems'
require 'gmailer'
def import
count=0
GMailer.connect('jobifier', 'password001') do |g|
g.messages(:label => "inbox") do |ml|
ml.each_msg do |conversation|
Email.create!(
:title => conversation.subject,
:text => conversation.body,
:sender => conversation.sender,
:sender_email => conversation.sender_email,
:reply_email => (conversation.reply_email.blank?) ?
conversation.sender_email : conversation.reply_email
)
count += 1
conversation.archive
end
end #connect
end
count
end
Alain Ravet