Ant 邮件任务 - 发送带有附件的邮件时出现问题 [英] Ant mail task - Issue in sending mail with attachments

查看:43
本文介绍了Ant 邮件任务 - 发送带有附件的邮件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I tried using ant mail task, it doesnot seem to work when it comes sending mail with attachments. The problem I am currently facing is, it sends the attachment(s) content in the body of the email, rather than as attachement, even though verbose output displays as, it is sending with attachment. As initially it complained for missing jars, I added mail.jar & activation.jar. Here is the snippet which I tried:

<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

推荐答案

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

It worked fine, after adding another dependent jar 'ant-javamail.jar'.

这篇关于Ant 邮件任务 - 发送带有附件的邮件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆