Re: problem is body content dependant

"Max Waterman" <[email protected]> Fri, 26 May 2006 23:31:04 +0800
Newsgroups gmane.comp.lang.perl.modules.mail-box
Message-ID <[email protected]>
I tried chopping the line up into shorter bits (to rule out the long
line as being the problem), but it didn't make any difference.

I shortened my code into a test case :

"
#! /usr/bin/perl -w

use strict;
use Mail::Box::Manager;

my $debug = 1;

my $mgr  = Mail::Box::Manager->new;

print "Opening pop3 server\n" if ( $debug );
my $pop3    = $mgr->open(
  type        => 'pop3',
  username    => '[email protected]',
  password    => 'test123',
  server_name => 'mail1.nthcode.com',
  access      =>  'rd',
  trace       => 'PROGRESS',
) || die( "Could not open pop3 mailbox:$!" );

# process incoming messages
my $number_of_messages = defined(@$pop3)?@$pop3:0;
print "Found $number_of_messages message",
($number_of_messages==1)?"":"s", "\n"
  if ( $debug );
foreach my $pop3_message (@$pop3) {
  my $pop3_sender = $pop3_message->sender();
  my $sender_text = $pop3_sender->format() if ( defined( $pop3_sender )
  );

  if ( defined( $sender_text ) ) {

    print "Message from $sender_text\n" if ( $debug );
    print "Message :".$pop3_message->body()->string()."\n" if ( $debug
    );

  }

}

print "Closing pop3 server\n" if ( $debug );
$pop3->close();
"

This body[1] fails :

"
$ ./test.pl
Opening pop3 server
Found 1 message
PROGRESS: Loaded head of 1148656311.29789.delta.ifmx.net.
Message from Nthcode Fastmail Account <[email protected]>
ERROR: Cannot read POP3 from socket: Connection reset by peer
WARNING: Message 1148656311.29789.delta.ifmx.net disappeared from POP3
server pop3://[email protected]@mail1.nthcode.com:110.
PROGRESS: Loaded message 1148656311.29789.delta.ifmx.net.
Message :
Closing pop3 server
Use of uninitialized value in concatenation (.) or string at
/usr/lib/perl5/site_perl/5.8.6/Mail/Transport/POP3.pm line 301.
ERROR: Server at mail1.nthcode.com:110 does not seem to be talking
POP3.:
"

but this body[2] works ~OK (apart from the final ERROR - at least I get
a message body).

"
$ ./test.pl
Opening pop3 server
Found 1 message
PROGRESS: Loaded head of 1148656630.30986.delta.ifmx.net.
Message from Nthcode Fastmail Account <[email protected]>
PROGRESS: Loaded message 1148656630.30986.delta.ifmx.net.
Message :id=MaxWasHere

Closing pop3 server
ERROR: Cannot read POP3 from socket: Connection reset by peer
"

subsequent runs, however, fail :

"
$ ./test.pl
Opening pop3 server
Use of uninitialized value in concatenation (.) or string at
/usr/lib/perl5/site_perl/5.8.6/Mail/Transport/POP3.pm line 301.
ERROR: Server at mail1.nthcode.com:110 does not seem to be talking
POP3.:
ERROR: Cannot create POP3 client for
pop3://[email protected]@mail1.nthcode.com:110.
WARNING: Folder does not exist, failed opening pop3 folder
pop3://[email protected]@mail1.nthcode.com:110.
Could not open pop3 mailbox:Connection reset by peer at ./test.pl line
34.
"

Any clues anyway? Am I doing something stupid (again)?

Max.

[1]
id=U2FsdGVkX18DpVlpB
wf4g4wZKKMPGvjo0XaOj
Akv0N9su0emBPf0CnryY
G_HYOianrqtx8VPW3PpR
MPjcKwNd_0sE1L_3ygbO
J2opLHxeEF6J0GvTUHte
mzk_ZHkbiZqvM3Fky1xj
3Y-;1.1=kldjfl;2.1=a
klsdjf;3.1=alkjsdf;4
.1=slkdjf;5.1=lkajsd
f;5.2=lakjdf;6.1=lkj
df;7.1=lkj;8.1=klj;9
.1=lkj;9.2=lkj;9.3=l
kj;9.4=lkj;10.1=klj;
11.1=klj;12.1=lkj;Su
bmit%20answers=Submi
t%20answers;submit_t
ime=1148655361

[2]
id=MaxWasHere

On Fri, 26 May 2006 16:33:28 +0800, "Max Waterman"
<[email protected]> said:
> The problem I am seeing only occurs with messages that have a single
> line body similar to :
> 
> id=U2FsdGVkX18uZyHScb4LFkhoq3uwiZ8K9jYGphstMXCOd5N5BpvkjmVNrFbHOq0AwrJ5PCpgu71ZUNYvWSmADHiNTn.pMZ1iWSqU8pF5kPU5wMGOGFKx.Alo42ETQRWziBf2jzS_G40-;1.1=jh;2.1=j;3.1=jh;4.1=kjh;5.1=kj;6.1=jk;7.1=kj;8.1=kj;9.1=j;10.1=kj;11.1=kj;11.2=k;12.1=k;12.2=k;12.3=k;12.4=k;Submit%20answers=Submit%20answers;submit_time=1148629814 
> 
> but works fine with messages that have a single line body similar to :
> 
> id=MaxWasHere
> 
> Other POP3 clients (eg thunderbird, and fastmail.fm's web mail) don't
> seem to have any trouble with the problem line.
> 
> Anyone any ideas how to fix it?
> 
> Max.
> 
> On Fri, 26 May 2006 09:23:34 +0800, "Max Waterman"
> <[email protected]> said:
> > Time is of the essence for my project - have to get it working again
> > today - so I'll probably wind back the version of Mail::Box to the
> > version I had before. I had upgraded it in the hope that it would
> > include a fix to make it POP3 work again, but it only made things
> > worse...
> > 
> > Any idea how best to downgrade Mail::Box?
> > 
> > Max.
> > 
> > On Thu, 25 May 2006 10:47:40 -0400, "Scott Bronson"
> > <[email protected]> said:
> > > On Thu, 2006-05-25 at 14:37 +0800, Max Waterman wrote:
> > > > I have hit this problem too. Applying your fix seemed to stop it from
> > > > happening, but revealed a lot of similar errors[1].
> > > 
> > > Dunno if you've seen this, but Mark suggested a different fix to that
> > > problem:
> > > 
> > >  -  {   @auth = map { $clientside{$_->[0]} ? delete
> > > $clientside{$_->[0]} : () }
> > >  +  {   @auth = map { $clientside{$_} ? delete $clientside{$_} : () }
> > > 
> > > I haven't tried his fix yet.
> > > 
> > > Like you, I found that getting past this bug unmasked deeper problems.
> > > I haven't had a chance to look into it yet.  Is anybody working on the
> > > imap code?
> > > 
> > >     - Scott
> > > 
> > > 
> > > 
> > > 
> > 
>