#!/usr/bin/perl my $mailprog = '/usr/lib/sendmail'; open(MAIL, "|$mailprog -t"); print MAIL "To: $SENDER\n"; print MAIL "From: $RECP\n"; print MAIL "$Here_is_where_the_body_of_your_message_goes"; close MAIL; #### #!/usr/bin/perl use MIME::QuotedPrint; use MIME::Base64; use Mail::Sendmail 0.75; %mail = ( SMTP => $SMTPSERVER, from => $SENDER, to => $RECP, subject => $Subject, ); $boundary = "====" . time() . "===="; $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; $message = encode_qp( "Text of message"); $file = 'message.txt'; # This is the file name $mail{body} = encode_base64( $message ); $boundary = '--'.$boundary; $mail{body} = <