4
當我嘗試使用ant郵件任務時,它似乎無法正常發送帶附件的郵件。我目前面臨的問題是,它會將附件內容發送到電子郵件正文中,而不是作爲附件,即使詳細輸出顯示爲正在使用附件發送。 由於最初抱怨缺少罐子,我添加了mail.jar & activation.jar。 這裏是我試過的片段:螞蟻郵件任務 - 用附件發送郵件的問題
<mail mailhost="mailHost.com" messagemimetype="text/html" subject="Test report" >
<from address="[email protected]"/>
<replyto address="[email protected]"/>
<to address="[email protected]"/>
<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的幫助?我的意思是你可以刪除屬性,以便它可以採用默認值 – Vishal
不,它不。默認情況下,mimetype是文本/純文本。我試過也沒有指定它。它沒有工作。 – user1587504