Email not getting deleted on server [Net::POP3]

Hello,

I created a rake task to fetch email from Gmail’s server using
Net::POP3. Everything works, except the messages are not getting
deleted. Here’s my code:

task :receive => :environment do
require ‘net/pop’
pop = Net::POP3.new(‘localhost’, 42) # localhost:42 is because of
stunnel
pop.start(’[myaddress]’, ‘[mypassword]’)
unless pop.mails.empty?
pop.delete_all do |m|
StuffMailer.receive(m.pop)
end
end
end

I also changed delete_all to each_mail and added “m.delete” after the
StuffMailer line, which still did not work. I also tried Net::IMAP,
but I kept getting “unexpected token ATOM (expected SPACE)” errors.

How can I resolve this problem -or- how can I resolve the IMAP error?
Thank you.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs