#!/usr/bin/perl -w -I/var/tmp/perl-root/usr/lib/perl5/site_perl # A perl program to send email by command line. Up to five attachments. # Usage: "mailerX ToEmailAddress MessageBodyFile [Attachment1] [Attachment2] [Attachment3] [Attachment4] [Attachment5] " use MIME::QuotedPrint; use MIME::Base64; use MAIL::Sendmail; # 0.75; # doesn't work with v. 0.74! $ToEmailAddress=$ARGV[0]; $MessageBodyFile=$ARGV[1]; $Attachment1=$ARGV[2]; $Attachment2=$ARGV[3]; $Attachment3=$ARGV[4]; $Attachment4=$ARGV[5]; $Attachment5=$ARGV[6]; %mail = ( SMTP => 'mail.teleport.com', from => 'THUNDERCHIEF! ', to => "$ToEmailAddress", subject => 'Renegade auto-mailer', 'X-Mailer' => "Mail::Sendmail version $Mail::Sendmail::VERSION", ); $boundary = "====" . time() . "===="; $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; $message = encode_qp( "Voilà le fichier demandé" ); $file = $^O; # This is the perl executable open (F, $file) or die "Cannot read $file: $!"; binmode F; undef $/; $mail{body} = encode_base64(); close F; $boundary = '--'.$boundary; $mail{body} = <