zip and email files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting zip and email files
# 8  
Old 09-21-2009
Correct Answer

Quote:
Originally Posted by methyl
Here is a method to mail the file as an attachment with unix sendmail. I've tested the method with a file compressed with unix "compress", mailed the file as an attachment, saved the attachment and checked with unix checksum "cksum".

Code:
(
echo "From: `uname -n` ${LOGNAME}"
echo "Subject: Mail Test from `uname -n` `date`"
# The next line appears as the message body
echo "Zip file attached"
# The next line creates the attachment with a suitable extension
uuencode file.zip file.zip
echo "."
) | /usr/lib/sendmail mailadd@group.com




Hi,
This works perfectly.Smilie
Thanks you so much for your help.

Regards,
Bhushan

---------- Post updated 09-21-09 at 12:08 AM ---------- Previous update was 09-20-09 at 11:39 PM ----------

Hi methyl,

One more small help needed. I am using your code and its working perfectly. However I could not see to email address specified in email, after I receive email in my mailbox. From email address and subject/attachement/body all are visible.

Regards,

---------- Post updated at 12:14 AM ---------- Previous update was at 12:08 AM ----------

Got it......I changed as below -


(
echo "From: `uname -n` "
echo "Subject: Mail Test from `uname -n` `date`"
echo "To: abc@abc.com"
# The next line appears as the message body
echo "Zip file attached"
# The next line creates the attachment with a suitable extension
uuencode bank_Listing1.zip bank_Listing1.zip
echo "."
) | /usr/lib/sendmail -vt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (1 Reply)
Discussion started by: b.saipriyanka
1 Replies

2. UNIX for Beginners Questions & Answers

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (2 Replies)
Discussion started by: b.saipriyanka
2 Replies

3. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies

4. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

5. Shell Programming and Scripting

Zip Multiple files to One .zip file in AIX system

Hi I have a requirement in unix shell where I need to zip multiple files on server to one single .zip file. I dont see zip command in AIX and gzip command not doing completely what I want. One I do .zip file, I should be able to unzip in my local Computer. Here is example what I want... (9 Replies)
Discussion started by: RAMA PULI
9 Replies

6. Shell Programming and Scripting

need to zip 2 GB file and send it via email

i want to zip the 2GB file and send it via email from unix machine using uuencode. could you please suggest whether it will possible or not and also command to do it. (3 Replies)
Discussion started by: mail2sant
3 Replies

7. AIX

ZIP multiple files and also specify size of zip file

I have to zip many pdf files and the size of zip file must not exceed 200 MB. When size is more than 200 MB then multiple zip files needs to be created. How we can achieve this in UNIX? I have tried ZIP utility but it takes a lot of time when we add individual pdfs by looping through a... (1 Reply)
Discussion started by: tom007
1 Replies

8. UNIX for Advanced & Expert Users

Zip an excel file and email using script.

Hi All, Currently i am using below script to attach excel and email from a Unix script. uuencode ASC.xls|mailx -m -s "ABCD_subject`TZ=CST+24 date +%d-%b-%y`" email@email.com Can anyone give me or help me in zipping excel and sending that email as the excel is very heavy. Thanks, (14 Replies)
Discussion started by: Nithin
14 Replies

9. UNIX for Dummies Questions & Answers

unzip .zip file and list the files included in the .zip archive

Hello, I am trying to return the name of the resulting file from a .zip archive file using unix unzip command. unzip c07212007.cef7081.zip Archive: c07212007.cef7081.zip SecureZIP for z/OS by PKWARE inflating: CEP/CEM7080/PPVBILL/PASS/G0063V00 I used the following command to unzip in... (5 Replies)
Discussion started by: oracledev
5 Replies

10. UNIX for Dummies Questions & Answers

zip and email a file

I am trying to zip and email a .csv file from my unix box to myself and I get corrupt file. I have used the gzip to zip the file and I am using Winzip to try to unzip it. I'm not sure what I am doing wrong. Should I be using the zip command? (4 Replies)
Discussion started by: spalmarez
4 Replies
Login or Register to Ask a Question