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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值