The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > SCO
.
google unix.com




Thread: Print to Email
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-12-2009
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink Here is a piece of one of my scripts

Some of the variables are defined earlier in the script. However, this might provide some basics of emailing a file attachment to people.

Code:
echo "#### Emailing the reports"
# create summary for email
echo "Summary Report of items un-processed ${DataSet} data ">$msgtxt
echo "Script name = ${SCRIPT} " >>$msgtxt

# over-ride default set by unix
m_frv='set from=abc@xyz.com; set realname="Client Automation"'
m_subj="Items Analysis"
# recipient
m_recipients="jg@xyz.com"
# people to get cc copies
m_recipients_cc="group@xyz.com"
 
# determine the size of the file attachment; if greater than 65k lines do not send
#  Excel does not like these long files; email may not like to send large files
csv_cnt=$(wc -l ${workx4} | awk '{print $1}')
if [ $csv_cnt -lt 65000 ]
   then
     /usr/local/bin/mutt -nx -e "$m_frv" -s "$m_subj" -a "$workx4" -c "$m_recipients_cc" "$m_recipients" <$msgtxt
   else 
     /usr/local/bin/mutt -nx -e "$m_frv" -s "$m_subj" -c "$m_recipients_cc" "$m_recipients" <$msgtxt
fi