linux poison RSS
linux poison Email

Sending Mail through command line on Linux

Read mail or send mail to other users. The mail utility allows you to compose, send, receive, forward, and reply to mail. mail has two main modes: compose mode, in which you create a message, and command mode, in which you manage your mail.

While mail is a powerful utility, it can be tricky for a novice user. It is most commonly seen nowadays in scripts. Most Linux distributions include several utilities that are richer in features and much easier to use: mailers built into browsers such as Mozilla and Firefox, graphical mail programs distributed with GNOME (Evolution) and KDE (Kmail), and the terminal-based, full-screen utilities pine and elm. The GNU Emacs editor can also send and receive mail.

Below is the mail command through with you can send mail to any given user ...

mail -s "System Log" nikesh@domain.com

This command sends a message to the user nikesh, with a subject line of "System Log" and the text of the message read from the system logfile /var/log/messages.

Below are few other command line option that you can use with the mail command ...

-s    Specify subject on command line.
-c    Send carbon copies to list of users.
-b    Send blind carbon copies to list. List should be a comma-separated list of names.
-f    Read in the contents of your mbox for processing; when you quit, mail writes undeleted messages back to this file.
-i    Ignore tty interrupt signals. This is particularly useful when using mail on noisy phone lines.


0 comments:

Post a Comment

Related Posts with Thumbnails