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

x
?
Solved

how to attach files to mails

Posted on 1998-08-25
9
Medium Priority
?
317 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
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!

 

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

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.

Question has a verified solution.

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

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…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
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…
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.
Suggested Courses
Course of the Month9 days, 22 hours left to enroll

926 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