perl.beginners
[Top] [All Lists]

Re: Email does not send attachment ...

Subject: Re: Email does not send attachment ...
From: Robert H
Date: Tue, 08 Dec 2009 19:57:54 -0500
Newsgroups: perl.beginners


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_email@xxxxxxxxx',
     To =>  'your_email@xxxxxxxxx',
     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.

Bob

<Prev in Thread] Current Thread [Next in Thread>