Solved

how to attach files to mails

Posted on 1998-08-25
9
278 Views
Last Modified: 2010-04-21
I use sendmail to send reports to mails generated
by a C program; now I want to join attachments to
those mails but it is very hard to find informations
about sending attachments;
I need infos about the header of the mail (mime version
content type,...), about the mime coding method (we
have the mimencode prg on our server), and about the
way Eudora and others are able to decode those attachments.
I would like strong technical answers to quote you;
that's why I could give a lot of points.
TIA.
0
Comment
Question by:bruyere
9 Comments
 
LVL 2

Expert Comment

by:JYoungman
ID: 2006778
It may be easier just to concatenate the output of a series
of calls to uuencode(1).

0
 

Author Comment

by:bruyere
ID: 2006779
I was told that uuencode cuts the attachment in 64K blocs,
that's why I prefer mime encoding.
I need that the user only has to click on a link in his
message to open the attached document (a pic, a textfile
from Unix to Dos or Windows...).
I managed to do it with uuencode but I had some trouble;
Eudora didn't decode it, and I had to make some more job,
and I would like to avoid it.
0
 
LVL 1

Expert Comment

by:TSchock
ID: 2006780
It's a standard functionality of sendmail to send files ...
try "man sendmail" on a Solaris System
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Author Comment

by:bruyere
ID: 2006781
It was the first thing I did;
but there was no information about the way to attach a file.
I am now reading the MIME RFC1521 file to discover
element to build mails with attachments.

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2006782
sendmail itself cannot make attachements ;-(

The easyest way (I know:) is to use a perl script:

#! /usr/local/bin/perl
$msg = new MIME::Lite
  From     => 'me',
  To       => 'you',
  Subject  => "don't miss it";
attach $msg
  Type     => 'TEXT',
  Data     => 'Your text here';
attach $msg
  Encoding => 'base64',
  Path     => '/path/to/file/to/be/attached';
$msg->send;


You may generate this file on the fly by your C-code and call it
via system(), exec(), or whatever.
0
 

Author Comment

by:bruyere
ID: 2006783
The Hoffmann's comment is exactly the answer I need;
Before I give you the points, do you know some books
where I could find clear and concise informations about
structure of mails with examples and so on.  Books
available in my country aren't enough dedicated.
I will have to learn perl to apply your script; I already
have found the MIME library.
Many thanks.

0
 

Expert Comment

by:izar
ID: 2006784
Check the MIME RFCs (www.internic.net, among others) and the
implementation of mime packages like the one inside MHS (available from any good unix ftp site near you).


0
 

Author Comment

by:bruyere
ID: 2006785
I got the sources at www.perl.org;
it is already loaded and it runs, with some changes instead;
now analysing the output I managed to have it running in
a C program without encoding with a very short subprogram.
I would like to give the points to Mr Hoffmann to close the question.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 400 total points
ID: 2006786
Best source for mail structure are the RFCs (see izar's comment),
I don't know of any good book about that :(

If you need more info about this question, feel free to ask.
If your questions are more about the secrets of perl, I suggest
to post them at the perl topic, to get answers from the gurus
there (which are probably faster/better than mine;-))
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Tracking which app / process changes permission of a file in SOlaris 10 4 122
LastLogonTimeStamp Attribute 7 49
How to Change Interface on Cisco IOU 11 110
Access_log 17 146
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…
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…
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…
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.:

809 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