Once installed, the mailx command can be directly referenced with
the name mail, so you just type in that in the command line.
1. Simple mail
Run the following command, and then mailx would wait for you to
enter the message of the email. You can hit enter for new lines. When done
typing the message, press Ctrl+D and mailx would display EOT.
After than mailx automatically delivers the email to the
destination.
$ mail -s "This is the subject" someone@example.comHi
someoneHow are youI am fineByeEOT
2. Take message from a file
The message body of the email can be taken from a file as well.
$ mail -s "This is Subject" someone@example.com <
/path/to/file
The message can also be piped using the echo command -
$ echo "This is message body" | mail -s "This is
Subject" someone@example.com
3. Multiple recipients
To send the mail to multiple recipients, specify all the emails
separated by a comma
$ echo "This is message body" | mail -s "This is
Subject" someone@example.com,someone2@example.com
4. CC and BCC
The "-c" and "-b" options can be used to add
CC and BCC addresses respectively.
$ echo "This is message body" | mail -s "This is
Subject" -c ccuser@example.com someone@example.com
5. Specify From name and
address
To specify a "FROM" name and address, use the
"-r" option. The name should be followed by the address wrapped in
"<>".
$ echo "This is message body" | mail -s "This is
Subject" -r "Harry<harry@gmail.com>" someone@example.com
6. Specify
"Reply-To" address
The reply to address is set with the internal option variable
"replyto" using the "-S" option.
# replyto email$ echo "This is message" | mail -s
"Testing replyto" -S replyto="mark@gmail.com"
someone@example.com # replyto email with a name$ echo "This is
message" | mail -s "Testing replyto" -S
replyto="Mark<mark@gmail.com>" someone@example.com
7. Attachments
Attachments can be added with the "-a" option.
$ echo "This is message body" | mail -s "This is
Subject" -r "Harry<harry@gmail.com>" -a /path/to/file
someone@example.com
60 Finger
In Unix, finger is a program you can use
to find information about computer users. It usually lists the login name, the
full name, and possibly other details about the user you are fingering. These
details may include the office location and phone number (if known), login
time, idle time, time mail was last read, and the user's plan and project
files. The information listed varies, and you may not be able to get any
information from some sites.
[/u03/appl/farbat1/suresh]$ finger -p <ch>
Login name:
ankloe
In real life: Sysadmin CH
Directory:
/home_ldap/ankloe
Shell: /bin/bash
Never logged in.
No unread mail
Login name:
bjholt
In real life: Sysadmin CH
Directory:
/home_ldap/bjholt
Shell: /bin/bash
Never logged in.
No unread mail
Login name:
roleem
In real life: SysAdmin CH
Directory:
/home/roleem
Shell: /bin/bash
Never logged in.
No unread mail
[/u03/appl/farbat1/suresh]$ finger -p suresh
Login name:
skunku
In real life: Suresh Kunku
Directory:
/home_ldap/skunku
Shell: /bin/bash
On since Sep 28 12:00:30 on pts/2 from nlamsp6xen152.upcit.ds.upc.biz
No unread mail
[/u03/appl/farbat1/suresh]$
EmoticonEmoticon