The
documentation for this module is very good IMHO. Try something like:
#!/usr/bin/perl
use strict;
use warnings;
use MIME::Lite;
my $msg = MIME::Lite->new(
From => 'sender@host.com',
To => 'recipient@host.com',
Subject => 'Word document attached',
Type => 'multipart/mixed');
$msg->attach(Type =>'TEXT',
Data => "Here's the Word document you wanted"
);
$msg->attach(Type => 'application/msword',
Path => 'test.doc');
$msg->send;
print "done";
I don't have Word installed, I tested this by sending it to my Gmail account which allowed me to open the word document in
google docs. Your code has a variable
$text which you don't seem to be doing anything with (in the code provided at least). Adding
use strict; and
use warnings; is always a good idea when you are having problems with your code. Check out
PerlMonks FAQ if you have not already done so. If the code above results in any error messages post a reply letting us know what they are and someone will try to help you.
Hope this helps
Martin