2009/12/9 Robert H <sigz...@gmail.com>:
> On 12/8/09 3:56 PM, Tony Esposito wrote:
>>
>> Hello,
Hi

>>   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;
>
> I see why you do that now. Sorry.

I don't see why. I would just do $msg->send (or send_by_smtp). Perhaps
I have missed something in the docs.

The part that I'd be concerning about (and would alter) are
Type=>'text/plain', I would make the 3rd attachment conditional (if -e
$path_to_log) { $msg->attach...} and yes I'd drop the MIME::Lite->send
and stick with the $msg->send.

HTH,
Dp.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to