pop( dest = '' )
Instance Public methods
This method fetches the message. If called with a block, the message is
yielded to the block one chunk at a time. If called without a block, the
message is returned as a String. The optional dest
argument
will be prepended to the returned String; this argument is essentially
obsolete.
Example without block
1 2 3 4 5 6 7 8 9 10 11 | POP3 .start( 'pop.example.com' , 110 , 'YourAccount, ' YourPassword') do |pop| n = 1 pop.mails. each do |popmail| File .open( "inbox/#{n}" , 'w' ) do |f| f.write popmail.pop end popmail.delete n += 1 end end |
Example with block
1 2 3 4 5 6 7 8 9 10 11 12 | POP3 .start( 'pop.example.com' , 110 , 'YourAccount, ' YourPassword') do |pop| n = 1 pop.mails. each do |popmail| File .open( "inbox/#{n}" , 'w' ) do |f| popmail.pop do |chunk| #### f.write chunk end end n += 1 end end |
This method raises a POPError if an error occurs.
Please login to continue.