标签:
1、首先,在环境中导入activation.jar和mail.jar,commons-email-1.2.jar。如果用eclipse中的ANT,步骤如下:
a) Window -> Preferences
b) Ant -> Runtime
c) Ant Home Entries -> “Add external JARs..."选择这几个jar包
d) apply and OK
2、示例build.xml
<target name="sendReport">
<loadfile property="report" srcFile="./test-output/html/overview.html" />
<mail mailhost="smtp.163.com" mailport="25" subject="Test Results Report" charset="utf-8" user="XXXXXX@163.com" password="XXXXXXXX" messageMimeType="text/plain">
<from address="XXXXXXX@163.com" />
<to address="XXXXXXX@163.com" />
<message>
Hi all,
This is Test Results Report,please view!
Thank you!
</message>
</mail>
</target>
标签:
原文地址:http://www.cnblogs.com/louytu/p/4584159.html