Jump to Navigation

080 - Use Mail command

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.

You can also provide much of the information on the command line, as shown in the following example:

[MyServer]# mail james -s "System Log" < /var/log/messages

If you want to send the user outside of the server.

[MyServer]# mail -s "This is a test" webmaster@mydomain.com

After you write down, you should enter [Ctrl]+[D].

Cc: <-- The prompt shows "Cc:", you should enter [Ctrl]+[D].

If the prompt shows "$", your e-mail is sent to the e-mail address you entered.

If you want to send a long text,

[MyServer]# cat messages.txt | mail -s testmail webmaster@mydomain.com


-v Verbose; print information about mail delivery to standard output.
-b Set blind-carbon-copy field to command-separated list.
-c Set carbon-copy field to command-separated list.
-s Set subject. Use quotes around subjects that contain spaces.




Main menu 2

Story | by Dr. Radut