I have been dabbling with Spreadsheet::WriteExcel::Simple and toying with the MIME types set by MIME::Lite and I can't find the correct combination of the two. What I typically end up with is a blah.xls file attached to the email and when you double-click it, you get the following error message: "Unable to read file."
Any help/suggestions are greatly appreciated. I apologize in advance if this is a newbie question. I have only been doing Perl for about four months now. Thanks.
-Scott
Here is sample code -- I won't paste the entire script to save you the pain of having to read it all. Notice the two lines where I have commented like this: " #<--- I don't know what to put here. "
~~~~~ BEGIN CODE SNIPPET ~~~~~
# Note that I am using the MIME::Lite module in this script to attach a file to a bunch of emails that I am sending out.
use MIME::Lite;
my $from_address = ' [EMAIL PROTECTED]';
my $to_address = '[EMAIL PROTECTED]';
my $subject = "yadda yadda yah";
my $mime_type = 'TEXT'; #<--- I don't know what to put here.
my $message_body = "$message";
# Create the initial text of the message
my $mime_msg = MIME::Lite->new(
From => $from_address,
To => $to_address,
Subject => $subject,
Type => $mime_type,
Data ="" $message_body
)
or die "Error creating MIME body: $!\n";
my $attachment = $filename;
my $recommended_filename = "something.xls";
# Attach the file
$mime_msg->attach(
Type => 'text/plain', #<--- I don't know what to put here.
Path => $attachment,
Filename => $recommended_filename,
Disposition => attachment
)
or die "Error attaching test file: $!\n";
MIME::Lite->send('smtp', "mymailserver.mynetwork.com", Timeout=>60);
$mime_msg->send; ### uses Net::SMTP <--- this line actually sends the email.
~~~~~ END CODE SNIPPET ~~~~~
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs