4

当我尝试使用 ant 邮件任务时,它在发送带有附件的邮件时似乎不起作用。我目前面临的问题是,它在电子邮件正文中发送附件内容,而不是作为附件,即使详细输出显示为,它正在发送附件。最初它抱怨缺少 jar,我添加了 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
4

1 回答 1

5

在添加另一个依赖 jar 'ant-javamail.jar' 后,它工作正常。

于 2012-12-03T13:25:51.070 回答