SUMMARY: Sending E-Mail With Attachments From A Script - Addendum

From: Dave Warchol (Warchol@harthosp.org)
Date: Mon Mar 24 2003 - 08:17:00 EST


I ended up getting several more responses after I had posted the
summary, so I decided to include them in this addendum.

I received several kudos for the summary, those really belong to
everyone who took the time to respond with suggestions.......

I did not try every approach that was suggested. What I did do (and
what worked just fine) was
to load mutt and use it from the command line as suggested.

--------------------------------------------------
>From Adam Ronthal:

I've used mpack to do this in the past. You'll have to compile from
source, but it runs fine on solaris.

http://ftp.se.kde.org/pub/mime/mpack/mpack-1.5-src.tar.gz
--------------------------------------------------
>From John Timon:

The key is in the MIME header

You need to include these two
Content-Type: multipart/mixed; boundary="---some arbitrary text --"

Then uuencode the attachment and append it to the end of the message
with
the boundary text as a separator between it and the actual message.
--------------------------------------------------
>From Bendriss Elmehdi:

i think you should have a look at uuencode and uudecode witch convert a
file to a standard format known by win and *nix (this is uuencode) and
you can have the file back with uudecode (c the man page)

--------------------------------------------------
>From Matt Garrett:

I did not see your original request , sorry
If you are doing this from perl then have a look at MIME::Entity
It allows to send all sorts of files e.g csv Excel files etc
Small snippet of perl code

use MIME::Entity ;
my $email_addrs = "Matt.M.Garrett\@is.shell.com";
my $header = "Nagios Availability Report \nDouble click to open and
launch
(Excel)";
my $subject = "Nagios Availability report .";
my $mail = MIME::Entity->build(
                                Subject => $subject,
                                To => $email_addrs,
                                Type => 'text/plain',
                                Encoding => '7bit',
                                Data => $header) ;

 $mail->attach(Encoding => 'base64',
                Type => 'application/msexcel',
                Description => 'Nagios Availability',
                Disposition => 'attachment',
                Filename => 'Nagios.CSV',
                Data => \@avail );

 $mail->send('sendmail') ;

--------------------------------------------------

Thanks Again,
Dave
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:26:02 EDT