linux mailx 中文乱码,HP-UX mailx发送邮件出现中文乱码问题

cat filename | mailx -s "subject" lilianjia@zking.com

上面命令在发送filename文件内容中存在中文的时候会在Outlook中出现乱码,查看mail头发现存在“charset="us-ascii",说明邮件使用us-ascii字符集解析了。

解决方法:在mailx命令加上-m参数

cat filename | mailx -m -s "subject" lilianjia@zking.com

-m 参数的意义

-m             Do not add MIME header lines Mime Version, Content

Type & Content Encoding to the header information

while sending mails.

确认下效果,不加-m参数的mail头部:

Received: from zjop01.zking.com (88.0.33.4) by ZJ-MAIL01.zking.com (88.0.64.2)

with Microsoft SMTP Server id 8.0.685.24; Wed, 22 Apr 2009 13:37:22 +0800

Received: (from oraywzkr@localhost)    by zjop01.zking.com (8.11.1

(PHNE_35951)/8.11.1) id n3M5bMr07169    for lilianjia@zking.com; Wed, 22 Apr

2009 13:37:22 +0800 (EAT)

Date: Wed, 22 Apr 2009 13:37:22 +0800

From: Message-ID: <200904220537.n3M5bMr07169@zjop01.zking.com>

To: lilianjia@zking.com

Subject: full_backup_200904220010.log

MIME-Version: 1.0

Content-Type: text/plain; charset="us-ascii"

Content-Transfer-Encoding: 8bit

Return-Path: oraywzkr@zjop01.zking.com

加上-m参数的mail头部:

Received: from zjop01.zking.com (88.0.33.4) by ZJ-MAIL01.zking.com (88.0.64.2)

with Microsoft SMTP Server id 8.0.685.24; Wed, 22 Apr 2009 14:29:21 +0800

Received: (from oraywzkr@localhost)    by zjop01.zking.com (8.11.1

(PHNE_35951)/8.11.1) id n3M6TLc12667    for lilianjia@zking.com; Wed, 22 Apr

2009 14:29:21 +0800 (EAT)

Date: Wed, 22 Apr 2009 14:29:21 +0800

From: Message-ID: <200904220629.n3M6TLc12667@zjop01.zking.com>

To: lilianjia@zking.com

Subject: full_backup_200904220010.log

MIME-Version: 1.0

Content-Type: text/plain

Return-Path: oraywzkr@zjop01.zking.com

邮件内容不再使用us-ascii解析,自然就没有乱码了。

发附件的方法:

uuencode filename filename | mailx -m -s "subject" lilianjia@zking.com

此处也必须加上-m参数,否则邮件会以乱码的内容发出来。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11411056/viewspace-733493/,如需转载,请注明出处,否则将追究法律责任。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值