因为某些需求,今天尝试着使用ant中的<mail>task发送邮件,提醒相关人员build成功完成。脚本很简单example如下:
<mail mailhost="smtp.126.com" mailport="25" subject="Build successful" charset="utf-8" user="[email protected]" password="thePassword">
<from address="[email protected]"/>
<fileset dir=".">
<include name="result.txt" />
</fileset>
<to address="[email protected]"/>
<message>some international text</message>
</mail>
使用mail脚步需要依赖mail.jar和activation.jar两个jar包
mail.jar
http://java.sun.com/products/javamail/
activation.jar
http://java.sun.com/products/javabeans/glasgow/jaf.html
在上述网址中下载第三方API,把其中的mail.jar和 activation.jar添加到ANT_HOME/lib下面,再运行ant脚本,就一切OK了~~
ANT自动发送邮件
猜你喜欢
转载自hqweye.iteye.com/blog/708633
今日推荐
周排行