Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to attach files to mails

Posted on 1998-08-25
9
Medium Priority
?
313 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
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…
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

688 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