Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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:


while read line; do

  echo $line >> /tmp/file


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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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