email mailbox output -

this was handy for me. stout goes to mail here.

#mailbox                                                                        
pgm=mailbox                                                                     
USER1=`eval whoami`                                                             
                                                                                
year1=$(date +%Y)                                                               
monthh=$(date +%h)                                                              
day2=$(date +%d)                                                                
local_date=$year1$monthh$day2                                                   
                                                                                
echo "All:"  > /home/$USER1/${pgm}_out                                          
echo "  for $year1 $monthh $day2 copy" >> /home/$USER1/${pgm}_out               
echo " "  >> /home/$USER1/${pgm}_out                                            
echo "$USER1 - check of mail" >> /home/$USER1/${pgm}_out                        
                                                                                
mail -p >> /home/$USER1/${pgm}_out                                              
                                                                                
mailx -s "$USER1 - $pgm/stout - for $local_date" "william.g.loughran@isomeplace.com"  < /home/$USER1/${pgm}_out

A ~/.forward file is a lot simpler, if local security allows. I can hold a list of addresses or a one line | script. See man sendmail, since sendmail -bd is the recieving email daemon most places ("Become Daemon").

thanks DGPickett I'll use that.
I should have mentioned - this stout from crontab here.