简体   繁体   中英

How to send Zip file using UUENCODE in unix

I need to send an e-mail with attachment as a zip file(containing multiple files zipped) using UUENCODE in UNIX(ksh). The mail has to send to multiple users with subject and a mail body. I tried with UUENCODE using the below command, but it is not working.

uuencode $zip_name $zip_name.zip | mailx -s "Mail Subject" "user@mail.com" 

- where $zip_name is name of the zip file.

How do I go ahead with this?

Thanks, Arun

I am guessing that the file cannot be located. Otherwise the below code would work just fine.

zip_name=some_file.zip
MESSAGE_BODY="Some text."
(printf "%s\n%s\n" "$MESSAGE_BODY"; uuencode $zip_name $zip_name)| mailx -s "${SUBJECT}" $TO

Odds on you're getting too much data for a mail body. Try using split(1) to split it up, or even better look on the web for the various incarnations of shar and make a shar file. Many of those will split the file automagically.

Here's a tutorial on using UUENCODE/UUDECODE and sharutils .

这是解决方案

echo "Your message" | uuencode "/home/ubuntu/test.zip" | mailx -s 'Your Subject' mail@example.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM