delete

delete()
Instance Public methods

Marks a message for deletion on the server. Deletion does not actually occur until the end of the session; deletion may be cancelled for all marked messages by calling Net::POP3#reset.

This method raises a POPError if an error occurs.

Example

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

delete!

doc_ruby_on_rails
2015-04-22 08:16:40
Comments
Leave a Comment

Please login to continue.