cajun has asked for the wisdom of the Perl Monks concerning the following question:

I'm having a problem with MIME::Lite that I'm not quite sure what is happening. I'm trying to achieve this in the header of the message (sent from Thunderbird):

Content-Type: text/plain; charset=ISO-8859-1; format=flowed

According to the documentation, to do this I should do something like this:

sub send_message{ $msg = MIME::Lite->new( From => 'someone@somewhere.com', BCc => "$_", Subject => 'Subject', Encoding => '7bit', Type => 'text/plain', Data => "$message" ); $msg->attr("content-type" => "text/plain"); $msg->attr("content-type.charset" => "ISO-8859-1"); $msg->attr("content-type.name" => "flowed"); $msg->send; }

When I do the above, what I get in the message header is:

Content-Type: text/plain; charset="ISO-8859-1"; name="flowed"

Note the quotes around ISO-8859-1 and flowed. Am I misunderstanding the documentation?

Thanks for any enlightenment,
Mike

Update: Thanks GrandFather Great find!

Replies are listed 'Best First'.
Re: MIME::Lite question
by GrandFather (Saint) on Jul 15, 2005 at 00:33 UTC

    RFC 2045 seems to imply the quotes are ok by giving examples both with and without quotes.


    Perl is Huffman encoded by design.
Re: MIME::Lite question
by pg (Canon) on Jul 15, 2005 at 01:43 UTC

    No worry!

    In the parameter list, the quotation marks in a quoted-string are not a part of the value of the parameter, so in your case, what you expected and what you got are equivalent. The receiving agent should be able to process with no problem.

Re: MIME::Lite question
by polettix (Vicar) on Jul 15, 2005 at 07:56 UTC
    Desired:
    Content-Type: text/plain; charset=ISO-8859-1; format=flowed
    Obtained:
    Content-Type: text/plain; charset="ISO-8859-1"; name="flowed"
    Unless there's a typo somewhere, it seems that you would like to set attribute content-type.format, but you're setting content-type.name:
    # ... $msg->attr("content-type.name" => "flowed"); #...

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.
      I tried it both ways polettix. It didn't seem to make a lot of difference either way.
        This does not surprise me, but they're different things. Name is usually related to a deprecated way to suggest a filename for attachments (this should be handled by Content-Disposition now), while the other is more text e-mail specific and deals with how nested replies should be displayed in variable-size windows - see here. So the question is: do you really need any of them?

        Flavio
        perl -ple'$_=reverse' <<<ti.xittelop@oivalf

        Don't fool yourself.