informatica利用ant发送邮件

1)用command调用ant 

#!/usr/bin/ksh
/test/infa/apache-ant-1.8.3/bin/ant -buildfile /test/infa/ant_mail/run_jiekou_status/build.xml

2)编写bulid.xml

<?xml version="1.0" encoding="utf-8" ?>
<project name="ant_mail" default="ant_mail" basedir=".">
<property file="email.properties" />
<target name="ant_mail" description="ant main task for send warning mail about error run">
<mail subject="${mail_name}" from="${mail.from.address}" tolist="${mail.to.addresses}" mailhost="${mail.smtp.host}" mailport="${mail.smtp.port}" user="${mail.account.user}" password="${mail.account.password}" ssl="${mail.smtp.ssl}">
<message charset="gb2312">--这里编码设置非常重要
${mail_content}
</message>
<attachments>
<fileset dir="${workflow.log.dir}">
<include name="${workflow.log.dir.file1}"/>
</fileset>
</attachments>
</mail>
</target>
</project>

3)编写属性文件

属性文件包含中文必须转码成gb2312

转码命令--native2ascii -encoding GBK resources.properties res.properties

#Write by Ferrari Huang ()
# Properties of Ant Tasks
mail.smtp.host=
mail.smtp.port=25
mail.smtp.ssl=false
mail.account.user=
mail.account.password=
mail.from.address=
mail.to.addresses=
workflow.log.dir=
workflow.log.dir.file1=ref_ctrl_jiekou_file1.out
mail_name=\u751f\u53d1\u73af\u5883-\u4e2d\u95f4\u5e93\u63a5\u53e3\u8868\u6570\u636e\u4f20\u8f93\u5931\u8d25
mail_content=\u4e2d\u95f4\u5e93\u63a5\u53e3\u8868\u6570\u636e\u4f20\u8f93\u5931\u8d25\uff0c\u5177\u4f53\u7cfb\u7edf\u540d\u79f0\u8868\u540d\u8bf7\u53c2\u8003\u9644\u4ef6\uff01

你可能感兴趣的:(informatica利用ant发送邮件)