Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

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.