【问题标题】:Ant mail task - Issue in sending mail with attachmentsAnt 邮件任务 - 发送带有附件的邮件的问题
【发布时间】:2012-12-03 21:25:51
【问题描述】:

当我尝试使用 ant 邮件任务时,它在发送带有附件的邮件时似乎不起作用。我目前面临的问题是,它在电子邮件正文中发送附件内容,而不是作为附件,即使详细输出显示为,它正在发送附件。 最初它抱怨缺少 jar,我添加了 mail.jar 和 activation.jar。 这是我试过的sn-p:

<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

【问题讨论】:

  • 我不确定,但改变 mimetype 有帮助吗?我的意思是您可以删除该属性,以便它可以采用默认值
  • 不,它没有。默认情况下,mimetype 将是 text/plain。我也尝试过没有指定它。它不起作用。

标签: email ant


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-13
    • 1970-01-01
    • 1970-01-01
    • 2017-09-13
    • 1970-01-01
    • 2017-07-31
    相关资源
    最近更新 更多