Hi Tmail chaps :) A quick query about preamble usage in TMail. Its currently an alias for body, which seems strange. I''d have thought that preamble is supposed to be the converse to epilogue. Eg:>> mail = TMail::Mail.parse "Content-Type: multipart/related;boundary=asdf\n\nThis is a mime message\n--asdf\nContent-Type: text/plain\n\npart 1\n--asdf--\nEpilogue" => #<TMail::Mail port=#<TMail::StringPort:id=0x..fdbb86ab8> bodyport=nil>>> mail.body=> "part 1\n">> mail.parts.first.body=> "part 1\n">> mail.quoted_body=> "This is a mime message\n">> mail.preamble=> "part 1\n">> q.epilogue=> "Epilogue" Is there a reason for this behaviour? I''m pretty sure rfc822 preamble is just that first chunk... Thanks, Charles -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/tmail-talk/attachments/20080229/b77f74b5/attachment.html
Hi,
The preamble is normally the part before the first boundary
delimiter. So it should have returned the text "This is a mime
message".
See also the following quote from RFC 2046:
There appears to be room for additional information prior to the
first boundary delimiter line and following the final boundary
delimiter line. These areas should generally be left blank, and
implementations must ignore anything that appears before the first
boundary delimiter line or after the last one.
NOTE: These "preamble" and "epilogue" areas are
generally not used
because of the lack of proper typing of these parts and the lack of
clear semantics for handling these areas at gateways, particularly
X.400 gateways. However, rather than leaving the preamble area
blank, many MIME implementations have found this to be a convenient
place to insert an explanatory note for recipients who read the
message with pre-MIME software, since such notes will be ignored by
MIME-compliant software.
Cheers,
Maarten
On 29-feb-2008, at 10:54, charles wrote:
> Hi Tmail chaps :)
>
> A quick query about preamble usage in TMail. Its currently an alias
> for body, which seems strange. I''d have thought that preamble is
> supposed to be the converse to epilogue.
>
> Eg:
>
> >> mail = TMail::Mail.parse "Content-Type: multipart/related;
> boundary=asdf\n\nThis is a mime message\n--asdf\nContent-Type: text/
> plain\n\npart 1\n--asdf--\nEpilogue"
> => #<TMail::Mail port=#<TMail::StringPort:id=0x
> ..fdbb86ab8> bodyport=nil>
> >> mail.body
> => "part 1\n"
> >> mail.parts.first.body
> => "part 1\n"
> >> mail.quoted_body
> => "This is a mime message\n"
> >> mail.preamble
> => "part 1\n"
> >> q.epilogue
> => "Epilogue"
>
> Is there a reason for this behaviour? I''m pretty sure rfc822
> preamble is just that first chunk...
>
> Thanks,
>
> Charles
> _______________________________________________
> Tmail-talk mailing list
> Tmail-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/tmail-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/tmail-talk/attachments/20080229/a41482a7/attachment.html
On Fri, Feb 29, 2008 at 8:54 PM, charles <aquasync at gmail.com> wrote:> Hi Tmail chaps :)G''Day :)> Is there a reason for this behaviour? I''m pretty sure rfc822 preamble is > just that first chunk...There reason for the behaviour is this bit of code is in lib/mail.rb: alias preamble body alias preamble= body It would be good to change it to the RFC, and at a quick glance, it would need a good test case or two written and then a re-work of how "read_multipart( src )" on line 500 of lib/mail.rb. Actually doesn''t look toooo hard to fix, would just take putting something in before the first while loop to grab the preamble. It would be great if you could take a shot at fixing it an putting a patch on our ruby forge page, there is a contributing to TMail page on the main tmail website. Right now I am concentrating on documentation, I have done about 500 + more lines of documentation and am trying to split out private methods from public methods and simplify the interfact to TMail a bit... getting there, but it is chewing up my TMail Time at a rapid rate :) Let me know what you think. Mikel
On Sat, Mar 1, 2008 at 11:50 PM, charles <aquasync at gmail.com> wrote:> Anyway, I''ve put up 2 patches on rubyforge. One is just a misc 1.9 fix, and > the other fixes preambles. Let me know if anything needs changing.Thanks Charles, looks good. Applied both of them to trunk, now at revision 233. Mikel