简体   繁体   English

如何在unix中使用UUENCODE发送Zip文件

[英]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). 我需要在UNIX(ksh)中使用UUENCODE发送带有附件的电子邮件作为zip文件(包含多个压缩文件)。 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,但它无法正常工作。

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. 尝试使用split(1)将其拆分,或者甚至更好地在网上查找shar的各种化身并制作一个shar文件。 Many of those will split the file automagically. 其中许多将自动拆分文件。

Here's a tutorial on using UUENCODE/UUDECODE and sharutils . 这是一个使用UUENCODE / UUDECODE和sharutils教程

这是解决方案

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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