当我尝试使用ant邮件任务时,它似乎在发送带附件的邮件时起作用。我目前面临的问题是,它将附件内容发送到电子邮件正文中,而不是作为附件发送,即使详细输出显示为,它也是附带发送的。 最初它抱怨丢失的罐子,我添加了mail.jar&的activation.jar。 这是我尝试过的片段:
<mail mailhost="mailHost.com" messagemimetype="text/html" subject="Test report" >
<from address="mymaild-addr@somedomain.com"/>
<replyto address="mymaild-addr@somedomain.com"/>
<to address="mymaild-addr@somedomain.com"/>
<message> Attached is sample report </message>
<attachments>
<fileset dir="${myRequiredDirectory}">
<include name="Test.txt"/>
<include name="Calls.txt"/>
</fileset>
</attachments>
</mail>
我得到了
[mail] Failed to initialise MIME mail: org.apache.tools.ant.taskdefs.email.MimeMailer
[mail] Failed to initialise UU mail: Class org.apache.tools.ant.util.ClasspathUtils can not access a member of class org.apache.tools.ant.taskdefs.email.UUMailer with modifiers ""
[mail] Sending email: Test report
[mail] Sent email with 2 attachments
答案 0 :(得分:4)
在添加另一个依赖jar“ant-javamail.jar”后,它运行良好。