备查ant配置发送邮件

官方文档:http://ant.apache.org/manual/Tasks/mail.html


1,先需要把javax.mail.jar添加到ant_home的lib目录下

2,配置build.xml

主要stmp服务器地址,端口,用户名,密码

一般邮件的设置里都有这些参数。

以163为例,如下

	<target name="mail" >
		<mail mailhost="smtp.163.com"
			mailport="994"
			ssl="true"
			user="[email protected]"
			password="*******"
			subject="ant mail"
			from="[email protected]"
			>
			<to address="[email protected]"/>
			<message>this is test message</message>
			  <attachments>
			    <fileset dir=".">
			      <include name="build.xml"/>
			    </fileset>
			  </attachments>
		</mail>
	</target>

附带一个附件


你可能感兴趣的:(备查ant配置发送邮件)