Solved

How to send binary file from commandline ?

Posted on 1997-08-26
11
322 Views
Last Modified: 2010-04-21
How can you send a binary file via e-mail, without using 'uuencode', and invoking the mailing process from the UNIX-command line ? I thought of mailing an ASCII-mail and then as a sort of attachment, the binary file. However 'mail' and 'sendmail' don't support MIME-file-attachment.
Some people suggested to use 'Elm', but I search for a straight way, so that there are no problems to use the command in a CGI-script or a UNIX-shell script.

You can wonder why I need this. Well, people can visit my services, and let carry out large calculations about construction models. Because the calculations usually take too much time to wait online for the results, I offer the possibility to enter their e-mail address and send the results by mail. The results are presented in a graphical format, showing the most dangerous stresses and strains in the construction model.
I'd like to send this binary file, so that people find it as an attachment (e.g. in Pine) in their mailbox.
Any help would be very welcome.
0
Comment
Question by:wvpaepeg
11 Comments
 

Author Comment

by:wvpaepeg
ID: 2006728
Edited text of question
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2006729
You **must** convert it anyhow to ASCII, either bei uuencode, base64, mime or whatever.
Your MUA (mail user agent) elm, mail, xmail doesn't matter; the MTA (mail transport agent) sendmail needs to get the data in ASCII, some MUAs just do this work on the fly for attachements.
0
 

Author Comment

by:wvpaepeg
ID: 2006730
But can't you use 'Elm' and other MUA's from the command line and attach a binary file to it ? How do these MUA's implement these facilities ?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2006731
Don't know :-(may be elm does it in one of its configuration files).
But what restricts you to use a command like:
   uuencode binary_file binary_file | mail -s "subject" addr
0
 

Author Comment

by:wvpaepeg
ID: 2006732
Well, I don't like this way, because my calculations should be used in a later stadium for business companies and others.
And the graphics file is usually 200 KB big, so I have to send four pieces of circa 64 KB, which they have to add together. This is not a user-friendly way of working.
I thought they would be able to find the file in attachment and just save it as a whole.
I read something about Elm, using with a parameter [include <file_name>], but I don't know if you can use it from the commandline.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 2006733
What's about your 64KB pieces? Do you split your data because of delivering problems (if > 50KB)? Then "elm include ..." (if available) will not help, because it wont split it for you.
0
 

Author Comment

by:wvpaepeg
ID: 2006734
Well, since 64 KB is a standard size for e-mail to handle, uuencode splits up the files into pieces of 64 KB.
But regarding to an Elm FAQ, the [include file_name] should handle about binary files, and send them in attachment without any splitting ( what of course it doesn't noeed to, because you don't have to add the binary pieces, it' only in case of using uuencode )
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2006735
> Well, since 64 KB is a standard size for e-mail to handle, uuencode splits up the files into pieces of 64 KB.

Who states this?
I.g. there is no limit for any email, theoretically. Just some ancient servers, forwarding email, may have such restrictions. This was the reason that mails should not exceed 64KB.
I don't know of any encoding (uuencode, base64, etc.) which are doing any splits; it must always be done before.
0
 
LVL 2

Accepted Solution

by:
df020797 earned 100 total points
ID: 2006736
Use the command rcp (user@host:)PATH (user@host:)PATH if the
r-services am open on the system. To achieve higher security (encryoted passowrd, RSA auth and encryoted tarffic during the copy) isntall ssh on both machines and use scp with same syntax.

0
 

Author Comment

by:wvpaepeg
ID: 2006738
I realize this is contrary to the original request -- no uuencode -- but here is the way I did
it using perl and it works great: (ahoffmann says the same thing)

#-----------------------------------------------------------------------
sub SendMail {
open(MAIL,"|uuencode orig_filename attached_filename|mail $email");
close(MAIL);
0;
}

0
 

Expert Comment

by:bowmanc
ID: 2006737
The visitors are not necessarily on the same network as I do. At this time they are, because we are in a developing phase, but in a later stadium the goal is to send these files to people on remote networks and I fear 'rcp' won't work then. I use this command already to copy files within our network, but it is rather slow.

By the way, can you explain some more about the terms 'RSA' and 'scp' ?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
prtdiag report hdd failure 10 135
Linux performance issues with 100% swap usage, etc 15 90
how to check for shares on aix 1 63
Unix Question 19 44
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now