|
|
Thanks to all. I abandoned MIME::Lite in favor Mail::Sender and got it to work
fine.
________________________________
From: Philip Potter <philip.g.potter@xxxxxxxxx>
To: "beginners@xxxxxxxx" <beginners@xxxxxxxx>
Sent: Wed, 9 December, 2009 6:06:01
Subject: Re: Email does not send attachment ...
2009/12/9 Sneed, Sean P <Sean.P.Sneed@xxxxxxxxxxxxxxx>:
> Try the paths like this C:\\my_file.log
Is there a reason that you suggested this? Perl under Windows, just
like C and C++ under Windows, accepts / as a directory separator just
fine. And if you stick to using / as your directory separator, porting
to unix-based systems becomes that much easier.
Perlmonks has a far more full discussion of the implications of using
"/" or "\\" as your directory separator under Windows:
http://www.perlmonks.org/?node_id=110030
and indeed there are some good reasons given for using "\\" in
filenames under windows, such as when you are passing a filename to a
system() call. But there are also good reasons for avoiding "\\", such
as consistency and portability. I doubt that MIME::Lite will be
affected by being passed a "/" delimited filename but I guess it's
worth a go. Without much more information to go on, though, it's hard
to diagose the original problem.
Phil
> -----Original Message-----
> From: Robert H [mailto:sigzero@xxxxxxxxx]
> Sent: Tuesday, December 08, 2009 6:58 PM
> To: beginners@xxxxxxxx
> Subject: Re: Email does not send attachment ...
>
> 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
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx For additional
> commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
> For additional commands, e-mail: beginners-help@xxxxxxxx
> http://learn.perl.org/
>
>
>
--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
For additional commands, e-mail: beginners-help@xxxxxxxx
http://learn.perl.org/
|
|