[ic] mime multipart & attachments

Kevin Walsh interchange-users@icdevgroup.org
Tue Oct 8 11:44:01 2002


> 
> If i put first "Plain text part" the received e-mail have right plain text
> but show a not extractable attachment.
> If i put first "Text file attach" the received e-mail show right attachment
> but the file content is duplicated in the mail message without "Plain text
> part".
> Someone has suggestions ?
> 
> ==============================================
> [email_raw]
> from: m.mescoli@omnibit.nu
> to: m.mescoli@omnibit.nu
> subject: Mime
> [tag mime header][/tag]
> 
> [comment]Plain text part[/comment]
> [tag mime Plain Text]Plain text content[/tag]
> 
> [comment]Text file attach part [/comment]
> [tag
>   op=mime
>   type=text/plain
>   description=|
> Text file attachment
> Content-Disposition: attachment; filename="myfile.txt"|]
> [include file="tmp/myfile.txt"]
> [/tag]
> [tag mime boundary][/tag]
> [/email_raw]
> ==============================================
> 
Try this instead:

    [email
        from="m.mescoli@omnibit.nu"
        to="m.mescoli@omnibit.nu"
        subject="Mime test"
        extra=|
            [tag op=mime arg=header attach_only=1][/tag]
    |]

    [tag op=mime type=|
        text/plain; charset="iso-8859-1"
    |]Plain text content[/tag]

    [tag op=mime type=|
        text/plain; charset="iso-8859-1"
    | description=|
        Text file attachment
        Content-Disposition: attachment; filename="myfile.txt"
    |][include file="tmp/myfile.txt"][/tag]

    [tag mime boundary][/tag]--
    [/email]

You needed the attach_only=1 to set the entity's MIME type to
"multipart/mixed" instead of the "multipart/alternate" default.

Also note the extra '--', which is required to close the MIME entity.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/