ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: <mail> attachment mime settings
Date Fri, 01 Apr 2005 22:14:51 GMT
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
<Ryan.Shoemaker@Sun.COM> 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="Ryan.Shoemaker@Sun.COM"
>            tolist="ryan.shoemaker@sun.com"
>            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: Ryan.Shoemaker@Sun.COM
> Subject: Java WS/XML Stats for 20050401
> To: Ryan.Shoemaker@Sun.COM
> 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:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message