首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

运用Ant发送邮件

2012-09-09 
使用Ant发送邮件?xml version1.0 encodingUTF-8?project namehello defaultpublic basedir

使用Ant发送邮件

<?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

热点排行