November 12th, 2009 at 6:19 pm
Linux attach, attachment, consol, 邮件, 附件, Linux, mail, mail with attachment, mailx, nail, terminal, uuencode, 带附件的Email, 带附件邮件, 文本模式
最近写一个脚本,需要直接在linux文本终端里面直接发送附件,而linux自带的那个什么mail命令,是由mailx包生成的,本身不带发送附件的功能。
放狗搜了一圈,发现基本上使用的都是mailx+uuencode这招。详情见http://www.webjx.com/server/linux-2724.html”
但是这种方式,是将文件转成ASCII码进行传输,在某些客户端(比如某些web客户端),很可能收到的就是一堆乱码。为了解决这个问题,我推荐另一个文本模式的邮件客户端:nail
不知道centos的官方源中有没有,但是,在rpmforge的源里面是肯定有的。装好之后,本身只会生成/usr/bin/nail这个命令,要是你很习惯用mail这个命令的话,可以考虑自己建立一个软链。
另附rpmforge源中nail包的information
# yum info nail
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.ustc.edu.cn
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* rpmforge: ftp-stud.fht-esslingen.de
* updates: centos.ustc.edu.cn
Installed Packages
Name : nail
Arch : x86_64
Version : 12.3
Release : 4.el5.rf
Size : 612 k
Repo : installed
Summary : Enhanced implementation of the mailx command
URL : http://nail.sourceforge.net/
License : BSD
Description: Nail is an enhanced mail command, which provides the functionality
: of the POSIX mailx command. It is derived from Berkeley Mail.
:
: Additionally to the POSIX features, nail can work with Maildir/ e-mail
: storage format (as well as mailboxes), supports IMAP, POP3 and SMTP
: procotols (including over SSL) to operate with remote hosts, handles mime
: types and different charsets. There are a lot of other useful features,
: see nail.html in the documentation.
:
: And as its ancient analogues, nail can be used as a mail script language,
: both for sending and receiving mail.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.ustc.edu.cn
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* rpmforge: ftp-stud.fht-esslingen.de
* updates: centos.ustc.edu.cn
Installed Packages
Name : nail
Arch : x86_64
Version : 12.3
Release : 4.el5.rf
Size : 612 k
Repo : installed
Summary : Enhanced implementation of the mailx command
URL : http://nail.sourceforge.net/
License : BSD
Description: Nail is an enhanced mail command, which provides the functionality
: of the POSIX mailx command. It is derived from Berkeley Mail.
:
: Additionally to the POSIX features, nail can work with Maildir/ e-mail
: storage format (as well as mailboxes), supports IMAP, POP3 and SMTP
: procotols (including over SSL) to operate with remote hosts, handles mime
: types and different charsets. There are a lot of other useful features,
: see nail.html in the documentation.
:
: And as its ancient analogues, nail can be used as a mail script language,
: both for sending and receiving mail.