When sending plain-text via a rails app, I am finding that single quotes
cause a very strange character code to appear… I am wondering what
the cause of this is, and how to fix it. This is how the email
appears… notice the problem with “MEN’S” and “WOMEN’S”:
http://www.collinatorstudios.com/www/budokonmail1.png
-patrick
this is the code I have currently for mailing email:
class Mailer < ActionMailer::Base
def send_newsletter(newsletter, contact)
return false unless contact.primary_email && contact.primary_email
=~ /\w+@\w+\.[\w.]+/
begin
recipients contact.primary_email
subject newsletter.subject
from '[email protected]'
part "text/plain" do |p|
if newsletter.newsletter.length == 0
p.body = ""
else
greeting = contact.first_name || 'Hello'
p.body = "#{greeting},\n\n" + newsletter.newsletter
end
end
newsletter.attachments.each do |attachment|
part attachment.content_type do |p|
p.body = attachment.contents
p.filename = attachment.filename
p.transfer_encoding = 'base64'
end
end
rescue
return false
end
return true
end
end