蚂蚁邮件的任务 - 在发行带有附件的邮件发送 [英] Ant mail task - Issue in sending mail with attachments

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

问题描述

当我试图用蚂蚁邮件的任务,它亘古不变的似乎说到带有附件的邮件发送工作。我目前面临的问题是,它发出的附件(S)含量在电子邮件的正文中,而不是作为attachement,虽然详细的输出显示为,它是带有附件发送。
由于最初它抱怨缺少的罐子,我添加了mail.jar和放大器;的activati​​on.jar。
这里是我试过的片段:

 <邮件邮件主机=mailHost.commessagemimetype =text / html的主题=测试报告>
<从地址=mymaild-addr@somedomain.com/>
<的ReplyTo地址=mymaild-addr@somedomain.com/>
<解决=mymaild-addr@somedomain.com/>
<&消息GT;附件是示例报告和LT; /消息>
<&附件GT;
<文件集DIR =$ {} myRequiredDirectory>
  <包括姓名=Test.txt的/>
  <包括姓名=Calls.txt/>
< /文件集>
< /附件>
< /邮件>

和我得到

  [邮件]无法初始化MIME电子邮件:org.apache.tools.ant.taskdefs.email.MimeMailer
[邮件]未能初始化UU邮箱:类org.apache.tools.ant.util.ClasspathUtils不能访问类org.apache.tools.ant.taskdefs.email.UUMailer的成员使用修改器
[邮件]发送电子邮件:测试报告
[邮件]发送电子邮件附件2


解决方案

它工作得很好,又增加依赖的jar'蚁javamail.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>

And I get

[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

解决方案

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

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

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