I believe your simplest solution will be to override
the mimetype mapping of your Java installation.  The
javadoc for javax.activation.FileDataSource,
javax.activation.FileTypeMap, and
javax.activation.MimetypesFileTypeMap contain more
information.  A fairly clean solution would be to
extract META-INF/mimetypes.default from activation.jar
and add the mimetypes you need, then store it in
another jar as META-INF/mime.types and make that jar
accessible to Ant by placing in $ANT_HOME/lib or
${user.home}/.ant/lib, or using the -lib command-line
option.

HTH,
Matt

--- Ryan Shoemaker - JavaSoft East
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I'm trying to send e-mail from an Ant script.  The
> message body
> is a chunk of html that references a small number of
> png files
> that I'm adding as attachments.  I'd like the
> message to render
> nicely in the mail client, but the problem I'm
> having is that I
> can't control the MIME settings on the attachments.
> 
> The code looks like this:
> 
>      <mail from="[EMAIL PROTECTED]"
>            tolist="[EMAIL PROTECTED]"
>            subject="Java WS/XML Stats for ${DSTAMP}"
>            messagefile="${reportdir}/index.html"
>            messagemimetype="text/html"
>            encoding="mime">
>        <fileset dir="${reportdir}">
>          <include name="*.png"/>
>        </fileset>
>      </mail>
> 
> Which almost works.  I get a message that looks like
> the following
> stripped down src.  The message body is correctly
> set to "text/html",
> but notice that the content type on the png
> attachments is wrong.
> It should be "Content-type: image/png;..."  Is there
> some way I
> can control the MIME settings on the attachments?
> 
> Thanks,
> 
> --Ryan
> 
> 
> 
> 
> 
> 
> 
>  From - Fri Apr 01 15:48:07 2005
> Date: Fri, 01 Apr 2005 15:43:24 -0500
> From: [EMAIL PROTECTED]
> Subject: Java WS/XML Stats for 20050401
> To: [EMAIL PROTECTED]
> MIME-version: 1.0
> Content-type: multipart/mixed;
> boundary="Boundary_(ID_nB9kKqgR9c+9aQGFJ43TyQ)"
> 
> --Boundary_(ID_nB9kKqgR9c+9aQGFJ43TyQ)
> Content-type: text/html; charset=ISO646-US
> Content-transfer-encoding: QUOTED-PRINTABLE
> 
> <html>
> [...snip...]
> </html>
> 
> --Boundary_(ID_nB9kKqgR9c+9aQGFJ43TyQ)
> Content-type: application/octet-stream; name=0.png
> Content-transfer-encoding: BASE64
> Content-disposition: attachment; filename=0.png
> 
> [...snip...]
> 
> --Boundary_(ID_nB9kKqgR9c+9aQGFJ43TyQ)
> Content-type: application/octet-stream; name=1.png
> Content-transfer-encoding: BASE64
> Content-disposition: attachment; filename=1.png
> 
> [...snip...]
> 
> --Boundary_(ID_nB9kKqgR9c+9aQGFJ43TyQ)
> Content-type: application/octet-stream; name=2.png
> Content-transfer-encoding: BASE64
> Content-disposition: attachment; filename=2.png
> 
> [...snip...]
> 
> --Boundary_(ID_nB9kKqgR9c+9aQGFJ43TyQ)
> Content-type: application/octet-stream; name=3.png
> Content-transfer-encoding: BASE64
> Content-disposition: attachment; filename=3.png
> 
> [...snip...]
> --Boundary_(ID_nB9kKqgR9c+9aQGFJ43TyQ)--
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Personals - Better first dates. More second dates. 
http://personals.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to