|
|
Question : mailx attachements
|
|
Hi.......... How do i send email from the command line using mailx. how do specify: to from subject attachements ...R
|
Answer : mailx attachements
|
|
#! /usr/bin/perl use MIME::Lite; if ($#ARGV < 3) { print "usage: $0 \n"; exit( 1 ); } else { $to = shift; $subject= shift; $text = shift; $file = shift; } $data = `cat $text`; $msg = new MIME::Lite From => '[email protected]', To => $to, Subject => $subject, Type => 'multipart/mixed'; attach $msg Type => 'TEXT/plain', Data => $data; attach $msg Type => 'application/pdf'; Encoding => 'base64', Path => $file; #print $msg->print_header; #print $msg->header_as_string; #print $msg->print_body; #print $msg->body_as_string;
$msg->send; exit 0;
|
|
|
|
|