Forum: Rails-core (closed, excessive spam) ActionMailer failing to parse a signed email message

Posted by Adam Greene (Guest)
on 2008-06-14 01:35
(Received via mailing list)
hey folks,

I have this email with a signed signature that is attached.  running
email.body on this message returns an empty string, even though there
are multiple parts.

I'm going to try and explain this without pasting in a long email
msg.  Why it is failing is fairly specific, I think.  This email
message is a signed email from the Apple Mail application:
Mime-Version: 1.0 (Apple Message framework v924)


I narrowed it down to failing on the Content-Type row in the email
header.  The following header fails:
   Content-Type: multipart/signed; boundary=Apple-Mail-34-825208017;
micalg=sha1; protocol="application/pkcs7-signature"
If I change it to this, it works
   Content-Type: multipart/signed; boundary=Apple-Mail-34-825208017;
micalg=sha1

the problem seems to be where the boundary attribute is defined.  It
either has to be the last or the 2nd to last.  So the above content-
type header parses correctly, but so does
   Content-Type: multipart/signed; micalg=sha1; protocol="application/
pkcs7-signature"; boundary=Apple-Mail-34-825208017


I wanted to ask a naive question, but isn't the original content type
valid?

If so, the error resides in TMail::TextUtils.quote_boundary, and this
line (ln 266 in rails 2.0.2)
   remainder =~ /^(.*)(;.*)$/m
should instead be
   remainder =~ /^([^;]*)(;.*)$/m


If this is a valid error, I'll open a ticket and provide a drop-in
patch.
Thanks folks!
Adam
This topic is locked and can not be replied to.