当我尝试使用 ant 邮件任务时,它在发送带有附件的邮件时似乎不起作用。我当前面临的问题是,它在电子邮件正文中发送附件内容,而不是作为附件,即使详细输出显示为,它也是通过附件发送的。
由于最初它抱怨缺少 jars,我添加了 mail.jar 和activation.jar。
这是我尝试过的片段:
<mail mailhost="mailHost.com" messagemimetype="text/html" subject="Test report" >
<from address="[email protected] /cdn-cgi/l/email-protection"/>
<replyto address="[email protected] /cdn-cgi/l/email-protection"/>
<to address="[email protected] /cdn-cgi/l/email-protection"/>
<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' 后,它工作正常。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)