Visit Our UNIX and Linux User Community


email mailbox output -


 
Thread Tools Search this Thread
Operating Systems HP-UX email mailbox output -
# 1  
Old 03-30-2011
email mailbox output -

this was handy for me. stout goes to mail here.
Code:
#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


Last edited by Scott; 03-30-2011 at 02:47 PM.. Reason: Please use code tags
Bill L.
# 2  
Old 03-30-2011
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").
# 3  
Old 04-01-2011
thanks DGPickett I'll use that.
I should have mentioned - this stout from crontab here.
Bill L.

Previous Thread | Next Thread
Test Your Knowledge in Computers #896
Difficulty: Medium
BusyBox, written by Richard Stallman in 1995, is a software suite that provides several Unix utilities in a single executable file.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting email output in single line with out space in email

I have tried below email method and i am getting every thing in single line . i have put echo to provide space, but it is not helping my code ( echo "From: $FROM" echo "To: $MAILTO" echo "CC: $CC" echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo 'Content-Type: multipart/mixed;... (6 Replies)
Discussion started by: mirwasim
6 Replies

2. Shell Programming and Scripting

Email Format Output issues

Hi Guys, I have written a script, which output information from email notfication. The output works fine in HTML format, but non-html format it is not shown in a human readable format. Can you help with the format *** Script echo " Server Name : $CLIENT_CHECK "... (4 Replies)
Discussion started by: Junes
4 Replies

3. Shell Programming and Scripting

Send email if Output is available

hello can anyone debug these lines cd /usr/local/scripts ./build update ./build versions | grep available if then mail -s "update for server `hostname`" $EMAIL else echo -e "$YELLOW No update $RESET" fi echo "Please press a key - Back to main menu . . ." ; read but... (3 Replies)
Discussion started by: nimafire
3 Replies

4. UNIX for Dummies Questions & Answers

Formatting The Email Output

Hello All, When i use the single quotes around the variables i am getting each line in the array as seperate in the email as shown in code2 & output2. But i don't want those single quotes to be printed but each array element should be printed as seperate line as when i remove those single quotes... (1 Reply)
Discussion started by: Ariean
1 Replies

5. Shell Programming and Scripting

Using AWK to format output and email

Hello, I'm a bit stumped, for some reason when using AWK 'print' is not printing the entire date/line. awk '{print "Ticket #: " $1} {print "Queue : " $2} {print "Recieved : " $3} {print "AP Date : " $4} {print "Circuit ID : " $5} {print... (4 Replies)
Discussion started by: ArvinSodhi
4 Replies

6. Shell Programming and Scripting

Format the output to sent in Email

Hi I have a script #!/bin/sh # email addresses to send results to, separated by a space EMAILS="xxxx.yyyy@yahoo.com" SUBJECT="MySQL reporting " DISK_DATA_USAGE=/home/aaaa/usaage.txt mysql YYYYYYYY -e " select 100*sum(max_data_length) as disk_usage_pct from xxxxxx;" >... (2 Replies)
Discussion started by: asha210
2 Replies

7. AIX

Sending script output as email

Hi i have a script which executes daily through cron. The output of the script is appended to a log file everyday It also emails me the output of the logfile as we have the mailx command in the script The below is my requirement : Normally When I get the email it sends the entire content... (3 Replies)
Discussion started by: newtoaixos
3 Replies

8. Shell Programming and Scripting

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 (4 Replies)
Discussion started by: ab52
4 Replies

9. UNIX for Dummies Questions & Answers

direct output to a file then email it

Ok so i have this script and I dont know how to have the output go to a file and then email that file to someone. #!/bin/ksh print "AL" print "AM" print "AN" print "RL\n" nawk '/PROD/ {print $3, $2}' /home/user/switch_listtest | sort -k1,2 print "End of Report" Thank you in... (2 Replies)
Discussion started by: llsmr777
2 Replies

Featured Tech Videos