Help for replying a mail using shell

Hi,
I have tried a script which sends mail to the user and its working fine. Is there any possibility to reply to user mail which is available in the mailbox. I searched in internet but didnt find any solutions. Any help will be really useful.

 
mail -s "sample mail" abc@gmail.com < file

If you want do that automated, you can use a .forward and hand it over to procmail for example to filter out sender, subject etc. and decide by this what to do with the mail or trigger a script that sends a mail back directly.

Hi rogerben,

You can just use the mail utility on the unix system.

Just try;

mail

It should take you into the mailbox.

Regards

Dave

Dave ,
Can you provide the exact syntax of the command. The command just store some messages in /var/spool folder.

Hi,

The command should just be as above, however.

ss071a-root>mail
From root@ss071a.xxxxx.com Tue Aug 14 12:07:01 2012
Date: Tue, 14 Aug 2012 12:07:01 +0100 (BST)
From: Super-User <root@ss071a.xxxxx.com>
Message-Id: <201208141107.q7EB71qX008796@ss071a.xxxxx.com>
To: root@ss071a.xxxxx.com
Subject: Output from "cron" command
Content-Length: 183

Your "cron" job on ss071a
find /usr/lpp/tracker/tmp -name BED002\* -exec rm {} \;

produced the following output:

find: stat() error /usr/lpp/tracker/tmp: No such file or directory


? ?
?               print this help message
#               display message number #
-               print previous
+               next (no delete)
! cmd           execute cmd
<CR>            next (no delete)
a               position at and read newly arrived mail
d [#]           delete message # (default current message)
dp              delete current message and print the next
dq              delete current message and exit
h a             display all headers
h d             display headers of letters scheduled for deletion
h [#]           display headers around # (default current message)
m user          mail (and delete) current message to user
n               next (no delete)
p               print (override any warnings of binary content)
P               override default 'brief' mode and display ALL header lines
q, ^D           quit
r [args]        reply to (and delete) current letter via mail [args]
s [files]       save (and delete) current message (default mbox)
u [#]           undelete message # (default current message)
w [files]       save (and delete) current message without header
x               exit without changing mail
y [files]       save (and delete) current message (default mbox)
?

Or you could also try;

man mail

Regards

Dave