A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
-bash: mailx: command not found #Alpine apk add mailx #Arch Linux pacman -S mailx #CentOS yum install mailx #Fedora dnf install mailx #Docker docker run cmd.cat/mailx mailx
mailx 是一种智能邮件处理系统,其命令语法让人联想到 ed,其中的行被消息替换。 它基于 Berkeley Mail 8.1,旨在提供 POSIX mailx 命令的功能,并提供 MIME,IMAP,POP3,SMTP 和 S/MIME 的扩展。
mailx 提供了用于交互式使用的增强功能,例如 IMAP 的缓存和断开连接操作,消息线程,评分和筛选。
它也可以用作邮件批处理语言,用于发送和接收邮件。
mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr . . . mailx [-BDdeEHiInNRv~] [-T name] [-A account] [-S variable[=value]] -f [name] mailx [-BDdeEinNRv~] [-A account] [-S variable[=value]] [-u user]
-A name Executes an account command (see below) for name after the startup files have been read. -a file Attach the given file to the message. -B Make standard input and standard output line-buffered. -b address Send blind carbon copies to list. List should be a comma-separated list of names. -c address Send carbon copies to list of users. -D Start in disconnected mode; see the description for the disconnected variable option. -d Enables debugging messages and disables the actual delivery of messages. Unlike -v, this option is intended for mailx development only. -e Just check if mail is present in the system mailbox. If yes, return an exit status of zero, else, a non-zero value. -E If an outgoing message does not contain any text in its first or only message part, do not send it but discard it silently, effectively setting the skipemptybody variable at program startup. This is useful for sending messages from scripts started by cron(8). -f [file] Read in the contents of the user's mbox (or the specified file) for processing; when mailx is quit, it writes undeleted messages back to this file. The string file is handled as described for the folder command below. -F Save the message to send in a file named after the local part of the first recipient's address. -H Print header summaries for all messages and exit. -h hops Invoke sendmail with the specified hop count. This option has no effect when SMTP is used for sending mail. -i Ignore tty interrupt signals. This is particularly useful when using mailx on noisy phone lines. -I Shows the `Newsgroup:' or `Article-Id:' fields in the header summary. Only applicable in combination with -f. -n Inhibits reading /etc/mail.rc upon startup. This option should be activated for mailx scripts that are invoked on more than one machine, because the contents of that file may differ between them. -N Inhibits the initial display of message headers when reading mail or editing a mail folder. -q file Start the message with the contents of the specified file. May be given in send mode only. -r address Sets the From address. Overrides any from variable specified in environment or startup files. Tilde escapes are disabled. The -r address options are passed to the mail transfer agent unless SMTP is used. This option exists for compatibility only; it is recommended to set the from variable directly instead. -R Opens any folders read-only.
目标邮件地址
mailx 发送邮件(内容应在命令后键入,并以 Ctrl + D 结尾):
mailx -s "subject" to_addr
mailx 发送包含从另一个命令传递的内容的邮件:
echo "content" | mailx -s "subject" to_addr
mailx 发送包含从文件读取的内容的邮件:
mailx -s "subject" to_addr < content.txt
mailx 发送邮件给收件人,抄送给另一个地址:
mailx -s "subject" -c cc_addr to_addr
mailx 发送邮件,指定发件人地址:
mailx -s "subject" -r from_addr to_addr
mailx 发送带有附件的邮件:
mailx -a file -s "subject" to_addr