Syntax
mailx [-B] [-d] [-e] [-F] [-H] [-i] [-I] [-n] [-N] [-U] [-R] [-t] [-v] [-V] [-~] [-b bcc] [-c cc] [-h number][ -f [file | +folder ] ] [ -T file ] [ -u user ] [-s subject] Recipients
-B |
Do not buffer standard input or standard output. |
-d |
Turn on debugging output. (Neither particularly interesting nor recommended.) |
-e |
Test for the presence of mail. mailx prints nothing and exits with a successful return code if there is mail to read. |
-F |
Record the message in a file named after the first recipient. Overrides the record variable, if set. |
-H |
Print header summary only. |
-i |
Ignore interrupts. |
-I |
Include the newsgroup and article-id header lines when printing mail messages. This option requires the -f option to be specified. |
-m |
|
-n |
Do not initialize from the system default mailx.rc or Mail.rc file. |
-N |
Do not print initial header summary. |
-U |
Convert UUCP-style addresses to Internet standards. Overrides the conv environment variable. |
-R |
|
-t |
Scan the input for To:, Cc:, and Bcc: fields. Any recipients on the command line will be ignored. |
-v |
Pass the -v flag to sendmail. |
-V |
Print the mailx version number and exit. |
-~ |
Interpret tilde escapes in the input even if not reading from a tty. |
-b bcc |
Set the blind carbon copy list to bcc. bcc should be enclosed in quotes if it contains more than one name. |
-c cc |
Set the carbon copy list to cc. cc should be enclosed in quotes if it contains more than one name. |
-h number |
The number of network "hops" made so far. This is provided for network software to avoid infinite delivery loops. This option and its argument are passed to the delivery program. |
-r address |
Use address as the return address when invoking the delivery program. All tilde commands are disabled. This option and its argument is passed to the delivery program. |
-s subject |
Set the Subject header field to subject. subject should be enclosed in quotes if it contains embedded white space. |
recipient |
The recipient of the e-mail. |
-f [file] |
Read messages from file instead of mailbox. If no file is specified, the mbox is used. |
-f [+folder] |
Use the file folder in the folder directory (same as the fold er command). The name of this directory is listed in the folder variable. |
-T file |
Message-id and article-id header lines are recorded in file after the message is read. This option also sets the -I option. |
-u user |
Read user's mailbox. This is only effective if user's mailbox is not read protected. |
# Example 1 - Simple:
echo "This is the body."| mailx -s "mailx Test1" jsmith@abc.com
# Example 2 - Using Variables:
SUBJECT="mailx Test2"
EMAIL_ADDRESS="jsmith@abc.com"
BODY="This is the body of the message."
echo "$BODY" | mailx -s "$SUBJECT" "$EMAIL_ADDRESS"
# Example 3 - Attached File:
SUBJECT="mailx Test3"
EMAIL_ADDRESS="jsmith@abc.com"
BODY="This is the body of the message."
ATTACHED_FILE="/etc/hosts"
cat "$ATTACHED_FILE" | mailx -s "$SUBJECT" "$EMAIL_ADDRESS"
# Example 4 - Attached File to Windows Email:
SUBJECT="mailx Test4"
EMAIL_ADDRESS="jsmith@abc.com"
BODY="This is the body of the message."
ATTACHED_FILE_DIR="/etc/"
ATTACHED_FILE="hosts"
ATTACHED_FILE_AS="hosts.txt"
unix2dos "$ATTACHED_FILE_DIR$ATTACHED_FILE" > /tmp/"$ATTACHED_FILE_AS"
uuencode /tmp/"$ATTACHED_FILE_AS" /tmp/"$ATTACHED_FILE_AS" | mailx -s "$SUBJECT" "$EMAIL_ADDRESS"
rm /tmp/"$ATTACHED_FILE_AS"
分享到:
相关推荐
在安装和使用heirloom-mailx-12.5时,用户需要注意的是,由于它是一个命令行工具,所以可能需要熟悉一些基本的Unix/Linux命令和语法。不过,一旦掌握了基本用法,你会发现它是一个强大而灵活的邮件处理解决方案,...
bsd-mailx(ubuntu deb)bsd-mailx(ubuntu deb)bsd-mailx(ubuntu deb)
官方离线安装包,测试可用。请使用rpm -ivh [rpm完整包名] 进行安装
离线安装包,亲测可用
官方离线安装包,亲测可用
2. **脚本支持**:mailx 支持通过shell脚本进行扩展,这使得用户可以编写复杂的邮件处理程序,例如自动回复、过滤垃圾邮件或自动转发邮件。 3. **过滤和管道**:利用Unix的管道(pipe)和重定向(redirect)功能,...
标题中的"bsd-mailx_8.1.2-0.20071201cvs-3_i386.deb"和"mailx_20071201-3_all.deb"指的是两个不同的邮件处理软件的 Debian 包。`bsd-mailx` 是一个基于 BSD 的邮件传输代理,而 `mailx` 是一个命令行接口的邮件...
离线安装包,亲测可用
在Linux下发邮件相当方便,如果有需要通过定时发送邮件的,可以考虑用这个工具。
离线安装包,亲测可用
在“mailx-12.5-19.el7.x86_64”这个版本中,我们看到它是针对EL7(Enterprise Linux 7)平台的64位系统设计的。 mailx的核心功能包括: 1. **发送邮件**:用户可以通过命令行直接编写和发送邮件,支持附件,同时...
最新的mailx版本,可以替换Redhat自带的8.1版本 参考文章:http://blog.csdn.net/hansel/article/details/7672549
离线安装包,亲测可用
离线安装包,亲测可用
cd heirloom-mailx-12.5/ make && make install UCBINSTALL=/usr/bin/install vi /etc/nail.rc(在配置文件最后添加) set from=mag00g@xxx.com #(需修改)收件人显示的发件人名称,可填写你的名字等 set smtp=...
官方离线安装包,测试可用。请使用rpm -ivh [rpm完整包名] 进行安装
`mailx-12.5`是`mailx`的一个具体版本,可能包含了一些特有的功能或修复了某些问题。安装`mailx`通常可以通过包管理器完成,例如在Ubuntu上使用`sudo apt-get install mailx`,在CentOS上使用`sudo yum install ...
标题中的“bsd-mailx”指的是BSD MailX,这是一个在类UNIX系统中广泛使用的邮件传输代理(MTA),源自4.4BSD系统。BSD MailX是一个轻量级且可配置的邮件处理程序,支持多种扩展和插件,可以用于发送、接收和管理电子...
- **Shell:** 用户与内核之间的接口,提供命令解释功能。 - **应用程序:** 提供各种实用工具和服务,如编辑器、编译器等。 #### 四、Unix操作系统的模块化设计 **4.1 模块化设计的优势** - **易于定制:** 用户...
官方离线安装包,测试可用。请使用rpm -ivh [rpm完整包名] 进行安装