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
How to use "mail" to attach a file with an email? meili100 UNIX for Dummies Questions & Answers 2 02-23-2008 03:49 AM
uuencode: command not found when sending mail in LINUX bsandeep_80 UNIX for Advanced & Expert Users 2 10-02-2007 09:48 AM
How to attach a file & send mail thru script Mar1006 Shell Programming and Scripting 9 10-12-2006 09:54 AM
Need to attach a txt file while sending mail charan81 Shell Programming and Scripting 9 01-12-2006 01:44 AM
How to attach a file in mail? firebirdonfire UNIX for Dummies Questions & Answers 1 03-29-2001 08:38 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-04-2008
rohit22hamirpur rohit22hamirpur is offline
Registered User
  
 

Join Date: Nov 2008
Location: delhi
Posts: 8
How to attach a file in Linux mail command

How to attach a file in Linux mail command

Hi Guys,

Is there any way to attach a file in Linux mail command without using "uuencode"?

i.e.

Code:
file=/a/b/c/d/file.txtmail -s "Giga aks" abc@123.com <<HDoc`uuencode $file $file 2>/dev/null`HDoc
Here, I don;t want to use 'uuencode' command but want $file to be sent in the email as an attachment.



#2 (permalink)


Also, when I'm putting the below code (PSee inside `` backquotes) i.e. calling uuencode withing a for loop inside another parent for loop, something strange is happening.

Quote:
`for comp in $(ls -c Directory); do echo $comp;echo ===========; for file in $(find Directory/$comp -type f); do uuencode $file $file 2>/dev/null; done ; done`
Instead of showing each component in the email body and attaching the files under each $comp (a subfolder), this command is making a .txt file of the echo statement (except for the first iteration) i.e. for (echo $comp and echo ============ and attaching it in the email.

I want the output like:
---------------------------------------------------
HTML Code:
subfolder1===========<path1>/file1 <path1>/file2 <path1>/file3subfolder2===========<path2>/file4 <path2>/file5
---------------------------------------------------

Where, subfolder[12] are 2 folders inder Directory folder and path[12] are 2 different path which will be shown in the attachments/attached files in the email. and file[12345] are the files under those subfolders.

Note: Subfolder[12] and "===========" line under it should come in the email as simple text but the files under that should be shown as attachments under each subfolder[?] (which i think in using Linux Mail command is not possible as you have to configure your outlook email appliation).

Doesn't matter if I get the file[12345] in my email ...all together as attachments..as anyone can easily see the <path?> of a file[?] making a feel that this file is at that path. But, by using the above command within ``(backquotes)... what Linux is doing is:

Im getting only the following in the email body as text data :
---------------------------------------------------
HTML Code:
subfolder1===========
---------------------------------------------------

and
the below things are showing up as attached files... including the echo statement for 2nd subfolder2 and ========== line.

<path1>/file1 <path1>/file2 <path1>/file3

subfolder2
===========
<path2>/file4 <path2>/file5



If you want to try ... just create a folder Directory using another folder which contains some sub folders and files under that... and you'll get to know what i want to achieve.

I can provide more information in case anyone needs.
Thanks-



 

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:07 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