ANT发送邮件需要的3个JAR包:activation.jar、mail.jar、commons-email-1.2.jar
将这三个jar包放到 $ANT_HOME/LIB 路径下即可
内网发送邮件:
<target name="sendEmail">
<mail mailhost="internalmail.test.com" mailport="25" subject="SmokeTest Report!" messagefile="${JMeter.home}/extras/AutoTestReport${time}_failure.html" messagemimetype="text/html" tolist="${to_me_only}">
<from address="mim.zhang@test.com"/>
<fileset dir="${JMeter.home}/extras/">
<!-- <include name="AutoTestReport${time}.html"/> -->
<include name="expand.png"/>
</fileset>
<!-- <message>This email was sent automatically by ANT. <br />
Please check the automation test report by the link below. <br />
If there are any questions, please contact with mim. Thank you! <br /><br />
http://SZCOMPUTER/AutoTestReport${time}.html
</message> -->
</mail>
</target>
外网发送邮件
<target name="sendEmail">
<mail mailhost="stmp.qq.com" mailport="25" from="12345678@qq.com" user="12345678" password="*****" subject="SmokeTest Report!" messagefile="${JMeter.home}/extras/AutoTestReport${time}_failure.html" messagemimetype="text/html" tolist="${to_me_only}">
<fileset dir="${JMeter.home}/extras/">
<!-- <include name="AutoTestReport${time}.html"/> -->
<include name="expand.png"/>
</fileset>
<!-- <message>This email was sent automatically by ANT. <br />
Please check the automation test report by the link below. <br />
If there are any questions, please contact with mim Zhang. Thank you! <br /><br />
http://SZCOMPUTER/AutoTestReport${time}.html
</message> -->
</mail>
</target>