sending output of command via email

Hi all

i want to send the output of a command by email, i have done this

<comand> | mail -s <subject> <email address>

which works well, but if the command retunrs noting then i just get a blank email, is there a way to stop this

thanks

Adam

Try:

command > file.tmp
mailx -s "Subject" mailaddress <file.tmp
rm file.tmp

i tired that

i get this as an output now

Null message body; hope that's ok 

but i still get a blank email

does it matter that i am using grep -v to exclude something form the command return

Well try first just the output of the command,
and if it works start eliminating things, till you find where it stucks

Building on previous posts

command > file.tmp
if [ -s file.tmp ]
then
       mailx -s "Subject" mailaddress <file.tmp
fi
rm file.tmp