Got this working.

When I compiled the source of ant1.6.2, the class MimeMailer.class was not
compiled. Had to compile the class using Eclipse and then manually inserted
MimeMailer.class into ant.jar.

Also had to add charset="iso-8859-1" into the mail task, now everything
works ok.

Is this a known problem with the standard build script for ant ?

Jon

-----Original Message-----
From: Jonathan Hawkins [mailto:[EMAIL PROTECTED]
Sent: 29 March 2005 14:36
To: 'user@ant.apache.org'
Subject: Email Task not sending attachment


I am trying to send an email with an attachment using the Any Mail task.

If I use encoding=uu, it send the email but the attachment is included in
the body of the email.

If I use encoding=mime, I get :-

Exception caught: C:\tempFix\build.xml:12: Failed to initialise encoding:
mime
C:\tempFix\build.xml:12: Failed to initialise encoding: mime
        at
org.apache.tools.ant.taskdefs.email.EmailTask.execute(EmailTask.java:465)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
        at com.cedar.ant.AntServlet.processRequest(AntServlet.java:119)
        at com.cedar.ant.AntServlet.doPost(AntServlet.java:65)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:211)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
        at com.evermind._ctb._psd(Unknown Source)
        at com.evermind._ctb._bqc(Unknown Source)
        at com.evermind._ax._luc(Unknown Source)
        at com.evermind._ax._ucb(Unknown Source)
        at com.evermind._bf.run(Unknown Source)


I have activation.jar and mail.jar in my lib directory and within the lib
directory of Orion2.0.5. I have a servlet which uses ant.jat and a build.xml
to invoke these tasks, so the required libraries for the ant task are within
the same server environment.

I've looked through the user list, with no success, any information would be
greatly appreciated.

Here is the build.xml section

<target name="main">
    <echo message="Ant started for id ${session.id}"/>
    <echo message="${uname}"/>
    <echo message="${uemail}"/>
    <zip destfile="${session.id}/${uname}.zip">
      <fileset dir="${session.id}" includes="*" excludes="**/${uname}.zip"/>
    </zip>
    <mail encoding="mime" mailhost="mailserver" subject="Test build">
      <from address="[EMAIL PROTECTED]"/>
      <replyto address="[EMAIL PROTECTED]"/>
      <to address="${uemail}"/>
      <message>The ${session.id} nightly build has completed</message>
      <fileset dir="${session.id}" includes="**/${uname}.zip"/>
    </mail>
    <delete dir="${session.id}" includes="*" excludes="**/${uname}.zip"/>
    <!-- <delete dir="${session.id}"/> -->
  </target>




This email and any files transmitted with it are confidential 
and intended solely for the use of the individual or entity to 
whom they are addressed. Any unauthorised distribution or 
copying is strictly prohibited. Whilst Cedar Software Ltd 
takes steps to prevent the transmission of viruses via e-mail, 
we cannot guarantee that any email or attachment is free from 
computer viruses and you are strongly advised to undertake your 
own anti-virus precautions. Cedar Software Ltd grants no 
warranties regarding performance, use or quality of any e-mail 
or attachment and undertakes no liability for loss or damage, 
howsoever caused.  


For more information on Cedar Software and our products, 
please visit our web site at http://www.cedar.com/Home.asp


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


This email and any files transmitted with it are confidential 
and intended solely for the use of the individual or entity to 
whom they are addressed. Any unauthorised distribution or 
copying is strictly prohibited. Whilst Cedar Software Ltd 
takes steps to prevent the transmission of viruses via e-mail, 
we cannot guarantee that any email or attachment is free from 
computer viruses and you are strongly advised to undertake your 
own anti-virus precautions. Cedar Software Ltd grants no 
warranties regarding performance, use or quality of any e-mail 
or attachment and undertakes no liability for loss or damage, 
howsoever caused.  


For more information on Cedar Software and our products, 
please visit our web site at http://www.cedar.com/Home.asp


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

Reply via email to