Ruby on Rails Monday, January 2, 2012

My problem is that even though the format is perceived correctly in the
mail it only shows text for my attachments. All files are pre-uploaded
and just hooked on from the folder they're contained in the public
folder. I send my emails through smtp in my dev / prod) environment
file. I Run Rails 3.1 and Ruby 1.9.3.

Extraction from an email:

----==_mimepart_4eef18cd87cdb_145c160c9e899096
Date: Mon, 19 Dec 2011 11:58:21 +0100
Mime-Version: 1.0
Content-Type: image/jpeg;
charset=UTF-8;
filename=7339a0207435.jpg
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename=7339a0207435.jpg

From here on only a clutter of chars is rendered in the mail.

Any clue to how I can fix this? As far as I know it used to work in
Rails 3.0.

Code from my mailer class:

def send_email(supervisormail, user, params)

@supervisormail = supervisormail
@user = user
acase = @supervisormail.case

if Uploadcontent.count(:conditions => ["case_id = #{acase.id}"]) > 0

acase.uploadcontents.each do |uc|

if params[uc.id.to_s]

attachments[uc.filename] = File.read('public/uploadedfiles/' +
uc.filename)

end

end

end
mail(:to => supervisormail.to, :subject => supervisormail.subject, :from
=> supervisormail.from, :content_type => "text/plain")

end

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment