From: rabarama Date: 2009-09-23T17:15:15+09:00 Subject: Re: pleas help for forwarding an email > > I think you've got it backwards. You post code, then we can maybe give you > useful advice. Without code, I'm just guessing here. > (Right, i want a text before the first line of the email, not an email header) thanks... here is the code i use... ( uses actionmailer and i call it by Mailer_deliver_mymailer(tmail) ) It's a 3 level function couse i continued to add levels i found in the emails. It should be recoursive, but by now 3 is the max level it seems to me a email can reach. My email test is a multipart/alternative email with 2 inline images and 2 attachments. I comment attachments code couse working only with parts should work also att. In this code is not present the part where i add my text, but when i get the original mail from this it will be easy go on. This mailer sends a mail with only text part visible, and an html attachment with the html version. No other attachment is in the mail. def mymailer(mail) subject mail.subject recipients mail.to[0] from mail.from[0] sent_on Time.now if mail.multipart? then content_type 'multipart/alternative' mail.parts.each do |p| if p.content_type=="multipart/related" then part 'multipart/related' do |mp| p.parts.each do |sp| if sp.multipart? then mp.content_type 'multipart/alternative' mp.part 'multipart/related' do |mmp| sp.parts.each do |ssp| mmp.part :content_type => ssp.content_type, :disposition => ssp.disposition, # :charset => ssp.charset, :transfer_encoding => ssp.transfer_encoding, :body => ssp.body end # if sp.has_attachments? then # sp.attachments.each do |aa| # mmp.attachment :content_type => aa.content_type, # :original_filename => aa.original_filename, # :body => aa.read # # end # # end end else mp.part :content_type => sp.content_type, :disposition => sp.disposition, :transfer_encoding => sp.transfer_encoding, :body => sp.body # if p.has_attachments? then # p.attachments.each do |aa| # mp.attachment :content_type => aa.content_type, # :original_filename => aa.original_filename, # :body => aa.read # end # end end# sp multipart? end end else #p not multipart part :content_type => p.content_type, :disposition => p.disposition, :transfer_encoding => p.transfer_encoding, :body => p.body end # multipart/related end # parts cycle end # if multipart #here code for non multipart emails... end