mail

1) lezen van een bericht : p{xyz} / {xyz} is het nummer van een e-mail message

lees alle mails in als een text file : vim /var/spool/mail/root

2) Linux send email from console

To send an email from console you need to use mail command, which is an intelligent mail processing system which has a command syntax reminiscent of ed with lines replaced by messages. To send an email to somewhere@domain.com you need to type following command:

$ mail somewhere@domain.comOutput:

Subject: Hello
Hai,
How are you? Hope so you are fine :)
Take care
Babai
Vivek

. <Type  DOT (.) followed by ENTER KEY>
Cc: <Press ENTER KEY>You need to type . (dot) to send an email. To send contains of file (such as /tmp/message) as mail body then use following command:

$ mail -s 'Hai' somewhere@domain.com < /tmp/message

3) insert commands to mail application

$ mail

Mail version 5.6 6/1/95. Type ? for help.
"/var/spool/mail/hermie": 1 message 1 new
>U 1 D.Rhodes@spam.net Mon Feb 10 15:37 "Make Money Fast!"
U 2 Chris@qwerty.com Mon Feb 10 15:37 "Tennis, Anyone?"
& 2
Message 2:
Date: Mon, 10 Feb 1997 15:37:52 -0500
From: Chris@qwerty.com
To: hermie@fritz.com
Subject: Tennis, Anyone?
Wanna whack a few a 4:30 today? -Chris
& reply
Subject: Re: Tennis, Anyone?
Sure, I'll see you on the lower courts at 4:30.
^D
EOT
& header
U 1 D.Rhodes@spam.net Mon Feb 10 15:37 "Make Money Fast!"
>O 2 Chris@qwerty.com Mon Feb 10 15:37 "Tennis, Anyone?"
& delete 1
& q
Saved 1 message in /home/hermie/mbox

We've introduced several new commands here, so let's take a closer look at the five operations that were performed in this mail session:

As soon as I started the mail program, the mail headers were displayed, showing that both messages are marked U for unread. I displayed message 2 by entering a 2 at the prompt.

The reply command responded with an appropriate Subject line for message 2, Subject: Re: Tennis, Anyone?, and waited for me to enter the text of my message to Chris. Pressing ctrl-D makes EOT appear and sends my reply.

The header command displays the message headers. I've used it here to show the difference in the status flags. The > indicates that message 2 is current, and the message is marked as O for old.

I deleted the first message with delete 1 without even reading it, since the Subject line was rather dubious.