Solved

How to send binary file from commandline ?

Posted on 1997-08-26
11
324 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
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.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

830 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