Skip Menu |

This queue is for tickets about the Mail-Box CPAN distribution.

Report information
The Basics
Id: 73609
Status: resolved
Priority: 0/
Queue: Mail-Box

People
Owner: Nobody in particular
Requestors: sergio [...] serjux.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.097
Fixed in: (no value)



Subject: issues when email don't have messageId
my $mgr = Mail::Box::Manager->new; my $folder = $mgr->open( type => 'pop3', username => $CONFIG->{'username'}, password => $CONFIG->{'password'}, server_name => $CONFIG->{'server_name'}, access => 'rw', ); my @messages = $folder->messages; foreach my $message (@messages) { my $message_id = $message->messageId; my $msg = $folder->messageId($message_id); if (not defined $msg ) { print "email without messageId"; } } with one bad(invalid?) email without messageId, the function $folder->messageId() fails , because $message->messageId returns one id but is not the messageId of message because message it self don't have one. but I need one unique value to know what message should delete later. I hope that explain me clear, if not please ask me what information do you need. Or how can get $message again from $folder ? Thanks,
Subject: Re: [rt.cpan.org #73609] issues when email don't have messageId
Date: Fri, 30 Dec 2011 01:32:13 +0100
To: Sérgio Basto via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Sérgio Basto via RT (bug-Mail-Box@rt.cpan.org) [111229 21:42]: Show quoted text
> Thu Dec 29 16:42:26 2011: Request 73609 was acted upon. > Transaction: Ticket created by sergiomb > Queue: Mail-Box > Subject: issues when email don't have messageId > > with one bad(invalid?) email without messageId, the function > $folder->messageId() fails , because $message->messageId returns one id > but is not the messageId of message because message it self don't have one. > but I need one unique value to know what message should delete later.
The function generates a messageId because it is practical when a message gets created by the library. You shouldn't use the message-id this way: although the message-id must be unique according to the spec, that cannot be enforced. So, I could let you remove other messages by inserting spam messages with the same message-id as valid messages. You may also get the same message coming via different paths. For instance, via a mailinglist and directly. It contains different header information for instance spam lines... An other answer to the same question: when you use $msg->get('message-id') you will not get the auto-generation. You can also set your own msgid if there is none: $msg->get('Message-ID') or $msg->set('Message-ID' => $random); -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
From: sergio [...] serjux.com
On Thu Dez 29 19:32:26 2011, Mark@Overmeer.net wrote: Show quoted text
> An other answer to the same question: > when you use $msg->get('message-id') you will not get the auto- > generation. > You can also set your own msgid if there is none: > > $msg->get('Message-ID') > or $msg->set('Message-ID' => $random);
Thanks for your help but $msg->set Method set() is not defined for a Mail::Box::POP3::Message. foreach my $message (@messages) { as you can see in the code sample , I loop for all messages and after that , I want delete the ones that I had processed . I use $folder->messageId($message_id); but fails when no $message_id , is there another way to get $message , todo $message->delete; ?
Subject: Re: [rt.cpan.org #73609] issues when email don't have messageId
Date: Fri, 30 Dec 2011 16:33:42 +0100
To: Sérgio Basto via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <secretaris [...] nluug.nl>
* Sérgio Basto via RT (bug-Mail-Box@rt.cpan.org) [111230 14:58]: Show quoted text
> > $msg->get('Message-ID') > > or $msg->set('Message-ID' => $random);
Ah, yeh... $msg->get == $msg->head->get but that's not available for set().... should have been: $msg->head->set() Show quoted text
> foreach my $message (@messages) { > as you can see in the code sample , I loop for all messages and after > that , I want delete the ones that I had processed . I use > $folder->messageId($message_id); but fails when no $message_id , is > there another way to get $message , todo $message->delete; ?
Use seqnr -- MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
From: sergio [...] serjux.com
Well I solved the problem saving my own list of messageId with the messages. my $msg_by_messageId; $msg_by_messageId->{$message->messageId} = $message; and later $message = $msg_by_messageId->{$messageId}; so you may close the report, since it is rare got messages without messageId else what is failing function $folder->messageId(): $msg = $folder->messageId($messageId) which I have to change to: $msg = $msg_by_messageId->{$messageId}; or try that $folder->messageId() works with generated messageId by $message->messageId Thanks for yours support and happy new year :).
implementation issue, not a bug