Issue retrieving mail using TMail in Ruby on Rails

On receiving email, TMail parses the body of the email twice when I use this code. All other parameters are exact (from_email, email_subject). Any ideas?

def get_mail
  Net::POP3.enable_ssl(OpenSSL::SSL::VERIFY_NONE)  
  Net::POP3.start('pop.gmail.com', 995, "uname","pass") do |pop|  
  mail_header=[];mail_subject=[];mail_body=[];mail_from=[]
    unless pop.mails.empty?
       pop.each_mail do |mail|  
        email = TMail::Mail.parse(mail.pop)
        mail_subject =  email.subject
        mail_body =  email.body
        mail_from = email.from
        email_obj=EmailedQueries.new
        email_obj.save_email(mail_from, mail_subject, mail_body)          
        end 
    end
 end   
end

      

+2


a source to share


1 answer


I do not know; -)



I don't know what your real problem is. But have you tried the (new?) Poststone - it was used in Rails3: http://github.com/mikel/mail .

0


a source







All Articles