Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to send binary file from commandline ?

Posted on 1997-08-26
11
Medium Priority
?
335 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses

971 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