The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sending email attachments venush UNIX for Dummies Questions & Answers 2 06-05-2008 10:42 PM
Sending Attachments Through mailx vrk1219 HP-UX 4 08-27-2007 08:06 AM
sending attachments in mail rajendragora UNIX for Dummies Questions & Answers 6 01-31-2007 09:13 PM
sending attachments via unix Abhishek Ghose UNIX for Advanced & Expert Users 6 09-30-2005 01:49 PM
sending files as attachments SmartJuniorUnix How do I send email? 9 04-13-2001 04:34 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-07-2008
Registered User
 

Join Date: Jan 2008
Posts: 1
Sending multiple attachments

Hi people, I am new to this forums. I have a quick question I hope one of you could help me with. I am writing a script to send attachments via email. However I am having trouble when trying to send multiple attachments. Here is the code I am using:

Code:
send_mail()
{
uuencode $TMP $TMP1 > $TMP1
uuencode $TMP $TMP3 > $TMP3

cat $MAILGROUP | while read RECIPIENT
        do
           mailx -s "$BROKER" $RECIPIENT < $TMP1 < $TMP3		 
           STATUS=$?
           if [ $STATUS -ne 0 ]
              then
              exit 1
           fi
        done
}
$TMP, $TMP1 and $TMP3 have already been declared and the code works fine for sending emails and attachments, but this code only sends the $TMP3 file as an attachment and does not send $TMP1. I need the script to send both attached files in the same email. Can anyone help me with this?

Your responses are much appreciated.
Reply With Quote
Forum Sponsor
  #2  
Old 01-07-2008
awk awk is offline
Registered User
 

Join Date: Feb 2007
Posts: 119
I am not at a UNIX box, so try this modification

Quote:
Originally Posted by deo2k8 View Post
Hi people, I am new to this forums. I have a quick question I hope one of you could help me with. I am writing a script to send attachments via email. However I am having trouble when trying to send multiple attachments. Here is the code I am using:

Code:
send_mail()
{
uuencode $TMP $TMP1 > $TMP1
uuencode $TMP $TMP3 > $TMP3

cat $MAILGROUP | while read RECIPIENT
        do
           cat $TMP1 $TMP2 | mailx -s "$BROKER" $RECIPIENT		 
           STATUS=$?
           if [ $STATUS -ne 0 ]
              then
              exit 1
           fi
        done
}
$TMP, $TMP1 and $TMP3 have already been declared and the code works fine for sending emails and attachments, but this code only sends the $TMP3 file as an attachment and does not send $TMP1. I need the script to send both attached files in the same email. Can anyone help me with this?

Your responses are much appreciated.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
mailx, mailx attachment

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 01:48 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0