楼主能把你完整的XML文件贴出来吗?为什么我的是这个结果呢? Buildfile: build.xmlinit:BUILD FAILED file:C:/dist/build.xml:10: The <mail> task doesn't support the "user" attribute. Total time: 1 second C:\dist>-------------------------------------------------------------------------如果去掉user 和password则是下面的结果。Buildfile: build.xmlinit: [mail] Sending email: Test sendmail [mail] Failed to send emailBUILD FAILED file:C:/dist/build.xml:10: Problem while sending mime mail:Total time: 12 seconds---------------------------------------------------------------- 下面的是我的build.xml<?xml version="1.0"?> <!-- build.xml - a simple Ant buildfile --> <project name="Simple Buildfile" default="init" basedir="."> <!-- set global properties for this build --> <property name="lib" location="../ant15/lib"/> <property name="classpath" value="${lib}/activation.jar;${lib}/mail.jar"/> <target name="init"> <mail mailhost="smtp.mailcenter.com.cn" mailport="25" subject="Test sendmail" messagemimetype="text/html" user="xxxx" password="xxxx" > <from address="[email protected]"/> <to address="[email protected]"/> <message>I am trying to test send mail by ant </message> </mail> </target> </project>
问题解决了,多谢楼主, 象下面这样写就可以了,不过ANT要1.61以上。<?xml version="1.0"?> <!-- build.xml - a simple Ant buildfile --> <project name="Simple Buildfile" default="init" basedir="."> <target name="init"> <mail mailhost="smtp.mailcenter.com.cn" mailport="25" subject="Test sendmail" messagemimetype="text/html" user="xxxx" password="xxxx" > <from address="[email protected]"/> <to address="[email protected]"/> <message>I am trying to test send mail by ant </message> </mail> </target> </project>
需要认证的和不需要认证的
build.xml写法有什么不同吗?
Buildfile: build.xmlinit:BUILD FAILED
file:C:/dist/build.xml:10: The <mail> task doesn't support the "user" attribute.
Total time: 1 second
C:\dist>-------------------------------------------------------------------------如果去掉user 和password则是下面的结果。Buildfile: build.xmlinit:
[mail] Sending email: Test sendmail
[mail] Failed to send emailBUILD FAILED
file:C:/dist/build.xml:10: Problem while sending mime mail:Total time: 12 seconds----------------------------------------------------------------
下面的是我的build.xml<?xml version="1.0"?>
<!-- build.xml - a simple Ant buildfile -->
<project name="Simple Buildfile" default="init" basedir=".">
<!-- set global properties for this build -->
<property name="lib" location="../ant15/lib"/>
<property name="classpath" value="${lib}/activation.jar;${lib}/mail.jar"/>
<target name="init">
<mail mailhost="smtp.mailcenter.com.cn" mailport="25" subject="Test sendmail" messagemimetype="text/html" user="xxxx" password="xxxx" >
<from address="[email protected]"/>
<to address="[email protected]"/>
<message>I am trying to test send mail by ant </message>
</mail>
</target>
</project>
象下面这样写就可以了,不过ANT要1.61以上。<?xml version="1.0"?>
<!-- build.xml - a simple Ant buildfile -->
<project name="Simple Buildfile" default="init" basedir=".">
<target name="init">
<mail mailhost="smtp.mailcenter.com.cn" mailport="25" subject="Test sendmail" messagemimetype="text/html" user="xxxx" password="xxxx" >
<from address="[email protected]"/>
<to address="[email protected]"/>
<message>I am trying to test send mail by ant </message>
</mail>
</target>
</project>