Mailx

Mailx

mailx is a Unix utility program for sending and receiving mail, also known as a Mail User Agent program. It is an improved version of the mail utility.

mailx is a lightweight mail program which has a command syntax similar to ed. Mailx allows one to send and read email. Mailx cannot, by itself, receive email from another computer. It reads messages from a file on the local machine, which are delivered there by a local delivery agent such as procmail.

A simplified syntax with the most commonly used options is:
mailx [-s subject] [-a attachment ] [-r from-addr] to-addr . . .

  • -s subject of email (could be inserted later)
  • -r indicates the email's sender (not a standard argument)
  • -a file to be attached to email (in some versions)
  • -a specify additional header fields (in other versions)

The end of message is indicated by a single '.' or by hitting ctrl+d.In the simple send usage, you just type your message directly into mailx. But in real life, you'll decide to edit the message after you've been typing for a while. Mailx interprets input lines beginning with a tilde (~) as commands. Its ~v command causes mailx to invoke the text editor of your choice (defined by the VISUAL environment variable) on the message in progress, saved in a temporary file. It can be argued this feature makes Mailx a more powerful email composing tool than typical Graphical User Interface (GUI) Mail User Agents.

Example usage

A simple example prompt:mailx -s "From mailx" abc@cde.com
type the body ... EOT (i.e. Ctrl+d, then enter, to end).

Simple syntax to send email with subject 'From mailx' to abc@cde.com.

A more complex example mailx -s "the subject" -a arq1 -a arq2 -a "From:me"
"person1" "person2" mensagem . EOTSends message to person1 and person 2 with arq1 and arq2 as anex. The subject of message will be "the subject" and the receivers will see "me" as the sender.

Process the Variable in the Body of Mail example mailx -s "Subject" "dhil@yahoo.com" <<-EOT hi Dream, `date` this is the date on unix now EOT

In the above Example it will send the mail with the current date processed as follows. This is actually an example of a unix shell feature called a "here document." The mailx command has no idea where the text is coming from, it's just reading lines from its standard input. The stuff from the double less-than through the second EOT is interpreted by the shell, which runs the date command and inserts its output in the appropriate place. hi Dream, Thu Aug 23 02:25:38 EDT 2007 this is the date on unix now

One line example as a reminder for job completion

Suppose you have a job which it is going to run for a while. You don't want to stare at the screen to wait for its completion. You can switch to other terminal to work on other things but want to get notified the minute the job is completed. Here's the trick to do so:

sleep 24 && echo | mailx -s "XXX job completed" xxxxx@gmail.com

here "sleep 24" is just an example test run command to count for 24 seconds before the mailx command is executed. You should replace it with the job submission command of your choice. Once the job is completed, a mail with title "XXX job completed" and empty body will be sent to your gmail account. With gmail notifier, you will get notified the minute you receive the email and get to know that your job is completed. Of course, you can choose other email account and reminder method.

External references

[http://www.manpagez.com/man/1/mail/ Complete user's manual]


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Mailx — Saltar a navegación, búsqueda mailx es un programa que se encuentra en varios sistemas operativos Unix like para enviar y recibir correo, también conocido como programa MUA. Es una versión mejorada del programa mail de Unix. mailx es un programa… …   Wikipedia Español

  • mailx — is a Unix utility program for sending and receiving mail, also known as a Mail User Agent program. It is an improved version of the mail utility. mailx is a lightweight console application mail program which has a command syntax similar to ed.… …   Wikipedia

  • mailx — es un programa que se encuentra en varios sistemas operativos Unix like para enviar y recibir correo, también conocido como programa MUA. Es una versión mejorada del programa mail de Unix. mailx es un programa de correo que tiene una sintaxis… …   Wikipedia Español

  • mailx — Mail Extended erweitertes Programm zur Verwaltung elektronischer Post unter UNIX, Nachfolger von mail http://www.desy.de/cgi bin/man cgimailx …   Acronyms

  • mailx — Mail Extended erweitertes Programm zur Verwaltung elektronischer Post unter UNIX, Nachfolger von mail (http://www.desy.de/cgi bin/man cgimailx) …   Acronyms von A bis Z

  • Heirloom mailx — Saltar a navegación, búsqueda Heirloom mailx Desarrollador Gunnar Ritter http://heirloom.sourceforge.net/mailx.html Información general …   Wikipedia Español

  • Heilroom mailx — Heirloom mailx Desarrollador Gunnar Ritter http://heirloom.sourceforge.net/mailx.html Información general Última versión estable 1.13 ( …   Wikipedia Español

  • Nail (program/MUA) — Nail is a some times lightweight console based mail client, made to be a modern replacement for the ancient mailx command. It s fully compatible with mailx, but has a lot more features, which makes it appropriate for everyday use. Nail supports… …   Wikipedia

  • Client de messagerie — Un client de messagerie est un logiciel qui sert à lire et envoyer des courriers électroniques. Ce sont en général des clients lourds mais il existe aussi des applications Web (les webmails) qui offrent les mêmes fonctionnalités. La… …   Wikipédia en Français

  • Программы UNIX-подобных операционных систем — Это список популярных программ, работающих в операционных системах основанных на UNIX (POSIX совместимых). Некоторые из этих программ являются стандартными для UNIX подобных систем. Содержание 1 Системный софт 1.1 Общего назначения …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”