Multipart email, how to bypass the bug?

Hi, i've to send a mail in the multipart format, but it became a mess
because of a 2 years old bug. It change stuff like style="... to
style=3D" so the clients doesn't render the mail good.
I've open a bug report at
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1204-email-multipart-2-years-old-bug

But how can it be fixed temporally until the fix enter the rails source?

Hi, i've to send a mail in the multipart format, but it became a mess
because of a 2 years old bug. It change stuff like style="... to
style=3D" so the clients doesn't render the mail good.
I've open a bug report at
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1204-email-multipart-2-years-old-bug

I've got multipart html emails that work just fine. What are you doing
in your mailer ?

Fred

Frederick Cheung wrote:

I've got multipart html emails that work just fine. What are you doing
in your mailer ?

Fred

Nothing special. This is the code:

*** notifications.rb:

  def alert
    @sent_on = Time.now
    @from = 'test@test.com'
    @recipients = 'test@test.com'
    @subject = 'test'
    @body = {:reqst => '<div style="color:red">test</div>'}
  end

*** alert.text.plain.erb:

<%= @reqst %>

*** alert.text.html.erb:

<%= @reqst %>

*** console:

x = Notifications.create_alert

=> #<TMail::Mail port=#<TMail::StringPort:id=0x..fdb902954>
bodyport=#<TMail::StringPort:id=0x..fdb8fff88>>

x.encoded

=> "Date: Sun, 12 Oct 2008 21:30:13 +0200\r\nFrom: test@test.com\r\nTo:
test@test.com\r\nSubject: test\r\nMime-Version: 1.0\r\nContent-Type:
multipart/alternative;
boundary=mimepart_48f250492c08b_2098..fdbfb1b7e3e0\r\n\r\n\r\n--mimepart_48f250492c08b_2098..fdbfb1b7e3e0\r\nContent-Type:
text/plain; charset=utf-8\r\nContent-Transfer-Encoding:
Quoted-printable\r\nContent-Disposition: inline\r\n\r\n<div
style=3D\"color:red\">test</div>=\n\r\n--mimepart_48f250492c08b_2098..fdbfb1b7e3e0\r\nContent-Type:
text/html; charset=utf-8\r\nContent-Transfer-Encoding:
Quoted-printable\r\nContent-Disposition: inline\r\n\r\n<div
style=3D\"color:red\">test</div>=\n\r\n--mimepart_48f250492c08b_2098..fdbfb1b7e3e0--\r\n"

As you can see is: <div style=3D\"color:red\">test</div>
It adds that 3D (ascii: '=') and that cause the wrong rendering on a lot
of email clients :frowning:

As you can see is: <div style=3D\"color:red\">test</div>
It adds that 3D (ascii: '=') and that cause the wrong rendering on a lot
of email clients :frowning:

Isn't that normal? Give that the encoding is quoted printable, = signs have to be escaped. It does that with the mails I send and it does not cause a problem.

My emails do however contain a full html document (ie with a doctype, a top level html tag, a head tag, a body tag etc... rather than just a frament.

Fred

Frederick Cheung wrote:

Isn't that normal? Give that the encoding is quoted printable, = signs
have to be escaped. It does that with the mails I send and it does not
cause a problem.

My emails do however contain a full html document (ie with a doctype,
a top level html tag, a head tag, a body tag etc... rather than just a
frament.

Fred

I don't know if it normal, but it doesn't seems to me :slight_smile:
Actually i put only the html between body and /body excluded. I don't
know how good is to put also the html and head stuff. I think it'd add
some points to antispam software like spamassassin, and in the webmail
there would be 2 <html> tags.
Btw i've tried to add the html and head tags, and at least on my webmail
now it recognize the links.

But i don't know how right is to set the encode in the html/head, as
there is the value on the mail which tell the encode: Content-Type:
text/html; charset=utf-8

Frederick Cheung wrote:

I don't know if it normal, but it doesn't seems to me :slight_smile:

= is a special character when using quoted printable. That's just the
way it is (much like % is special in urls)

Actually i put only the html between body and /body excluded. I don't
know how good is to put also the html and head stuff. I think it'd add
some points to antispam software like spamassassin, and in the webmail
there would be 2 <html> tags.

As far as I know webmail clients are built to deal with this sort of
thing. Works for me anyway.

Fred