On 12/8/09 3:56 PM, Tony Esposito wrote:
Hello,
I am using Perl 5.8 on WindowsXP and Windows Server 2003. I can not get the
following attachment to arrive/attach even though I get the email with no
issues. Any ideas?
use MIME::Lite;
use Net::SMTP;
unless (-e 'C:/my_file.log'&& -s 'C:/my_file.log' ) { print "file not
found\n"; }
my $msg = MIME::Lite->new (
From => 'my_em...@yahoo.com',
To => 'your_em...@yahoo.com',
Subject => 'Testing error email',
Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";
$msg->attach (
Type => 'TEXT',
Data => 'Error in the module that caused this email',
) or die "Error adding the body text to email message: $!\n";
$msg->attach (
Type => 'TEXT',
Path => 'C:/my_file.log',
Filename => 'my_file.log',
Disposition => 'attachment'
) or die "Error adding file attachment: $!\n";
MIME::Lite->send('smtp', 'smtp.server.net', Timeout=>60);
$msg->send;
Why do you send twice? It should just be:
$msg->send('smtp', 'smtp.server.net', Timeout => 60);
__END__
Have you tried changing the last "Type" to 'AUTO' to see if MIME::Lite
can pass it through?
Another pair of eyes my be better at spotting bugs (I just got my
bifocals). :-(
Bob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/