Sponsored Content
Top Forums Shell Programming and Scripting Attach a binary file to email in a script Post 302384471 by durden_tyler on Tuesday 5th of January 2010 12:01:23 PM
Old 01-05-2010
Quote:
Originally Posted by fwellers
So I ran uuencode -m test.tar.gz test.tar.gz | mailx floydw@studentclearinghouse.org

and I got an email that looked like this:
begin-base64 644 test.tar.gz
H4sICChVQ0sAA3Rlc3QudGFyAOz9W5MjS3aYC+p5/wo85jycasQ9QjY2ZjwSpcMxSuSQLdnMvJRl
4pJVrURlCkBVo//9QbhHeEQ4Au5Y3wKK3cUNaSeNm3vF8su6+bp++sN6/3n79W1z+MN/eNRvmS+r
olj8h+VymeWZ/Z+J/d/73yJJsnRZFmmWZotlkqdJ9R8WxcNWNPp9Pxyf9+elHDbfjvu/rLbX/jv7
f7/+nW4f7n/+jfw+Dfe/ev+2/fr66XDcvL09f0qXyfL8/4vlMk2UOM4fKvN8cXFE5z9J+yvL1Lv/
KqmK/7BY3mWHkV9///v392Povzv85Xwwu+v/97/R+/8/tL/f/l/n3+LL++H47Xm3Wfw/z7/f9B+1
RHiHD5nVrZ+Pd1vZH79vFv/v52+LRbFYLv9jmvzHM8H+/b/+cdHyy73W+3542/zYvN1rycWn7NPy
091W93b4+HGvpX1Zfz38r+XC/c6sU9bbdbparrdJ2TwvZn4tp/54Hf7359Xx64+N/VRy+al0k2Vp
ui6ln0rnPrV6rjfVeu5TX78dN/tvz2+fu++NP5Vd+9RzIf1UPv7UqqqS9ap4Of95aaq5T/3Lvyaf
.......
... which is perfectly fine, since that is how it is supposed to look.

You'd then proceed to save the message and uudecode it to obtain the "test.tar.gz" file.

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to attach a file & send mail thru script

In shell script how can I attach a file and send a mail. suppose if I written like the following way usr/bin/mail 'subject" "mail_id" < file. a mail goes to the mail-id with the content of file.But I want the file to be atttached to the mail.How can I get it.is there any way for this. ... (9 Replies)
Discussion started by: Mar1006
9 Replies

2. Shell Programming and Scripting

hi.. how to attach a tar file using shell script

Hi, How to attach a tar file using shell script or the command liine.. I following command just send the mail to the person with .txt file as body, I want to send it as attachment. /usr/sbin/sendmail -f "user1@daemon.com" user2@daemon.com <hi.txt The contents of the hi.txt will be... (1 Reply)
Discussion started by: madhumathikv
1 Replies

3. UNIX for Dummies Questions & Answers

How to use "mail" to attach a file with an email?

echo "content" | mail email@address -s subject Where to attach a file with the email? (2 Replies)
Discussion started by: meili100
2 Replies

4. Shell Programming and Scripting

attach multiple files in email

I am trying to send multiple files as attachment in one email, I tried to search but couldn't find. Please let me know if any solutions. (2 Replies)
Discussion started by: mgirinath
2 Replies

5. Shell Programming and Scripting

attach multiple file in an email

Hello I have to attach multiple file as an email attachment. here is what i my understanding so far: 1. search in a certain directory that is there any specific file say for example .xml file exist or not 2. if exist then take those file name from the folder and attach it to another text... (1 Reply)
Discussion started by: osrukarigor
1 Replies

6. UNIX for Dummies Questions & Answers

How to attach a file in a email

Anyone can help me, in Unix, how can I attach a file in the email? Thank (3 Replies)
Discussion started by: ting123
3 Replies

7. Shell Programming and Scripting

Not able to attach text in body of email while sending mail with attachment

Hi, We have been trying to send mail with attachment and it is going fine, but when we try to attach a text to the body of the email, we find that the mail is going fine with the body text but the attachment is not going through. We are using ksh. The command that is successfull without the... (6 Replies)
Discussion started by: jmathew99
6 Replies

8. Shell Programming and Scripting

Script to attach file to mail

Hello, I have a .dat file containing one line. I need a script to read that line and make it part of the body and send a mail... Let's say the line is $line. I need the script to send a mail with the body "The last disposal feed is $line". Thanks (4 Replies)
Discussion started by: sfetea
4 Replies

9. Shell Programming and Scripting

Convert binary file to csv and then back to the binary format

Hello *nix specialists, Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies

10. UNIX for Beginners Questions & Answers

Check Error File attach and email zip file

I need something to say if these two file extensions exist in this directory *err and *rpt zip up these files into one zip file and email them to me. If they don't exist wait 2 hours and check again.... Not sure how to determine if I need to do an if then statement or a while true or a for... (1 Reply)
Discussion started by: xgringo
1 Replies
uuencode(1)						      General Commands Manual						       uuencode(1)

NAME
uuencode, uudecode - encode a binary file, or decode its representation SYNOPSIS
uuencode [-m] [ file ] name uudecode [-o outfile] [ file ]... DESCRIPTION
Uuencode and uudecode are used to transmit binary files over channels that support only simple ASCII data. Uuencode reads file (or by default the standard input) and writes an encoded version to the standard output, using only printable ASCII characters. The encoded output begins with a header, for use by uudecode, which records the mode of the input file and suggests name for the decoded file that will be created. (If name is /dev/stdout then uudecode will decode to standard output.) The encoding has the format documented at uuencode(5), unless the option -m is given, when base64 encoding is used instead. Note: uuencode uses buffered input and assumes that it is not hand typed from a tty. The consequence is that at a tty, you may need to hit Ctl-D several times to terminate input. Uudecode transforms uuencoded files (or standard input) into the original form. The resulting file is named name (or outfile if the -o option is given) and will have the mode of the original file except that setuid and execute bits are not retained. If outfile or name is /dev/stdout the result will be written to standard output. Uudecode ignores any leading and trailing lines. The program determines from the header which of the two supported encoding schemes was used. EXAMPLES
The following example packages up a source tree, compresses it, uuencodes it and mails it to a user on another system. When uudecode is run on the target system, the file ``src_tree.tar.Z'' will be created which may then be uncompressed and extracted into the original tree. tar cf - src_tree | compress | uuencode src_tree.tar.Z | mail sys1!sys2!user SEE ALSO
compress(1), mail(1), uucp(1), uuencode(5) STANDARDS
This implementation is compliant with P1003.2b/D11. BUGS
If more than one file is given to uudecode and the -o option is given or more than one name in the encoded files are the same the result is probably not what is expected. The encoded form of the file is expanded by 37% for UU encoding and by 35% for base64 encoding (3 bytes become 4 plus control information). REPORTING BUGS
Report bugs to <bug-gnu-utils@gnu.org>. Please put sharutils or uuencode in the subject line. It helps to spot the message. HISTORY
The uuencode command appeared in BSD 4.0. uuencode(1)
All times are GMT -4. The time now is 09:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy