Friday, October 2, 2009

Episode 4: Sendmail Local Mailbox Commands..

In the Last Episode we went through few Sendmail Masquerading stuffs,this time we will be exploring Local users malbox commands in details:

Say, There are Two users: Sender and Receiver.Sendmail is configured properly. Let us run this command logging in as sender:

[sender@Innova ~]$ echo " Hello" | mail -v -s "hi" receiver@localhost
receiver@localhost... Connecting to [127.0.0.1] via relay...
220 Innova.intinfra.com ESMTP Sendmail 8.14.2/8.14.2; Sat, 3 Oct 2009 14:26:02 +0530
>>> EHLO Innova.intinfra.com
250-Innova.intinfra.com Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From: SIZE=43 AUTH=sender@Innova.intinfra.com
250 2.1.0 ... Sender ok
>>> RCPT To:
>>> DATA
250 2.1.5 ... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 n938u2nS005377 Message accepted for delivery
receiver@localhost... Sent (n938u2nS005377 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 Innova.intinfra.com closing connection
[sender@Innova ~]$

A Mail has been sent to receiver in the same machine.
Let us now check if the mail has actually been received by user called receiver or not.

[receiver@Innova ~]$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/receiver": 1 message 1 unread
>U 1 sender@intinfra.co Sat Oct 3 14:26 17/674 "hi"
&

Yes It shows that receiver has received the mail.
Let us try out with other commands:

Type ? after & above and it will display lots of options:

[receiver@Innova ~]$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/receiver": 1 message 1 unread
>U 1 sender@intinfra.co Sat Oct 3 14:26 17/674 "hi"
& ^CInterrupt
& ?
Mail Commands
t type messages
n goto and type next message
e edit messages
f give head lines of messages
d delete messages
s file append messages to file
u undelete messages
R reply to message senders
r reply to message senders and all recipients
pre make messages go back to /usr/spool/mail
m mail to specific users
q quit, saving unresolved messages in mbox
x quit, do not remove system mailbox
h print out active message headers
! shell escape
cd [directory] chdir to directory or home if none given

A consists of integers, ranges of same, or user names separated
by spaces. If omitted, Mail uses the last message typed.

A consists of user names or aliases separated by spaces.
Aliases are defined in .mailrc in your home directory.
&


Let us see the mail sent by sender through this command:


Option 1:

& t sender
Message 1:
From sender@groupinfra.com Sat Oct 3 14:26:02 2009
Date: Sat, 3 Oct 2009 14:26:02 +0530
From: sender@groupinfra.com
To: receiver@groupinfra.com
Subject: hi

Hello

&


So Sender has simply sent "hello" Message with subjectline "hi".

Option 2:

Lets see another option to check new mail if any.

& n
At EOF
&


Option 3:

& f sender
> 1 sender@groupinfra.co Sat Oct 3 14:26 17/674 "hi"
&



Option 4:

& R sender
To: sender@groupinfra.com
Subject: Re: hi

I have received your mail Dude
.
Cc: ajeet.singh.raina@logica.com
& q
Saved 1 message in mbox

No comments:

Post a Comment