How to Use mailx to display Chinese content as attachments in linux bash

Source: Internet
Author: User


In linux bash, if you use mailx to send Chinese content and display it as an attachment, the mailx version is resolved. Here, mail is directed to the mailx Program # ll/bin/mail lrwxrwxrwx by default. 1 root 5 October 2011/bin/mail-> mailx www.2cto.com # mail-V 12.4 7/29/08 mail. rc configuration, set the external smtp server cat/etc/mail. rc # set sendcharsets = iso-8859-1, UTF-8 set from = demo@163.com smtp = smtp.163.com set smtp-auth-user = demo smtp-auth-password = demopassword smtp-auth = login send mail, content cannot be seen in the QQ mailbox. Only one attachment is seen. The content in the attachment is our Chinese content #! /Bin/bash... echo "Chinese content test! "|/Bin/mail-s" Chinese title "xxx@qq.com...


Www.2cto.com, however, it is normal to manually enter the command to receive the mail content. This may be caused by the failure of the system encoding environment when bash is running. View System encoding environment # locale LANG = zh_CN.gb18030 LC_CTYPE = "inherit" LC_NUMERIC = "inherit" LC_TIME = "inherit" LC_COLLATE = "inherit" LC_MONETARY = "inherit" LC_MESSAGES = "inherit" LC_PAPER = "canonical" LC_NAME = "canonical" LC_ADDRESS = "zh_CN.gb18030" LC_TELEPHONE = "canonical" LC_MEASUREMENT = "canonical" LC_IDENTIFICATION = "canonical" LC_ALL = www.2cto.com change the sending command #! /Bin/bash export LANG = zh_CN.gb18030 echo "Chinese content test! "|/Bin/mail-s" Chinese title "xxx@qq.com... is to receive the mail is displayed as Chinese. Author: islandstar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.