<?xml version="1.0" encoding="UTF-8"?>
<project name="hello" default="public" basedir=".">
<property file="attachments.properties">
</property>
<path id="email-classpath">
<fileset>
</fileset>
</path>
<!-- =================================
target: public
================================= -->
<target name="public" description="description">
<mail mailhost="smtp.qq.com" mailport="25" user="*******@qq.com" password="********">
<from address="*******@qq.com" />
<to address="*******@qq.com" />
<message>This Email from HeJian</message>
<attachments>
<fileset dir="${basedir}">
<include name="*.properties" />
</fileset>
</attachments>
</mail>
</target>
</project>
运行的时候可能会报:
Failed to initialise MIME mail: javax/mail/MessagingException
这时要加入两个jar包到lib下:
mail.jar , activation.jar