I'm calling shell scripts inside /etc/smrsh to process incoming emails as commands for my system. As I'm seeing all incoming emails are not making it to /var/mail/spool/USER.

Is there any way I can access to the content of the emails ? some variable $1 $2 comming with the content values ?

If not, how do I access to the content of the emails received ?

thanks guys

link|improve this question

67% accept rate
feedback

1 Answer

up vote 1 down vote accepted

If you're using a pipe alias, the content of the message is piped into your program/script as stdin.

So something like this (very ugly/inefficient) in bash:

#!/bin/sh

while read line; do

  echo $line >> /tmp/file

done

will put a copy of the message in /tmp/file.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.