ITPub博客

首页 > Linux操作系统 > Linux操作系统 > HP-UX mailx发送邮件出现中文乱码问题

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

原创 Linux操作系统 作者:ljm0211 时间:2012-06-20 20:18:24 0 删除 编辑
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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-05-14

  • 博文量
    272
  • 访问量
    437112