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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
mailx commannd - Mail and Attachment in same mail sharif UNIX for Advanced & Expert Users 6 03-19-2008 04:25 PM
mail with attachment param786 Shell Programming and Scripting 1 07-15-2007 12:20 PM
How To Add Attachment to Mail lesstjm Shell Programming and Scripting 3 12-06-2005 11:24 AM
mail attachment sushrut UNIX for Dummies Questions & Answers 3 08-28-2001 03:14 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-21-2007
thambi thambi is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 32
Mail with File attachment

I have a requirement that I would have to write a shell script for sending a mail. The logic is that script should send a mail with a file attachment. I know that I could use 'uuencode' for the attachment but It just displaying the file content in the mail but I just need to attach the file in the mail and send it to a Email id (Just like our normal mail attachment). Could you please let me know how I can proceed? Thanks in advance.

Cheers,
Thambi
  #2 (permalink)  
Old 03-21-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,560
show us how you use uuencode.
  #3 (permalink)  
Old 03-21-2007
thambi thambi is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 32
Cool

Eg:

SUBJ="Send mail from Unix with file attachments"
TO=someone@domain_name
CC=someoneelse_1@domain_name,someoneelse_2@domain_name
(
cat << !
To : ${TO}
Subject : ${SUBJ}
Cc : ${CC}
!

cat << !

uuencode ${file_1} ${file_1}
uuencode ${file_2} ${file_2}
uuencode ${file_3} ${file_3}
!

) | sendmail -v ${TO} ${CC}
  #4 (permalink)  
Old 03-21-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,560
i have not tried your code, but here is how i usually do it for example

Code:
uuencode file file | mail -s "subject" user@domain.com

for more examples, see here
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:31 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0