Mail issue

  • Thread starter Diego Bernardes
  • Start date
D

Diego Bernardes

Hello!

I need to get mails from a mail server using pop3, save to disk to later
resend.

The get part:

pop = Net::pOP3.new 'mail server'
pop.start 'address', 'password'

if pop.mails.empty?
puts "No mail"
else
puts "Have mails"

pop.mails.each_with_index do |m,i|
File.open("inbox/#{i}", "w+") do |f|
f.write m.pop
end
end
end


With this code i can download and save the mails into files.

Now i need get this files and resend as mails, this is the part isnt
working...

smtp = Net::SMTP.new 'mail address', port
smtp.start 'mail domain', 'username', 'password', :login

puts smtp.sendmail File.read(file from get path), 'from', 'to'


Well, the send part is broken, can anyone help me?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top