Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: danieltwc [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.106
Fixed in: 2.107



Subject: Add internaldate support to Mail::Transport::IMAP4
Hi, I'm importing mail into an IMAP server using Mail::Box and found that the server was reporting the time each message was appended to the folder as when it was received. Turns out that Mail::IMAPClient supports setting the internaldate attribute for this purpose; I've created a patch to add support for this to Mail::Transport::IMAP4: https://github.com/dwc/Mail- Box/commit/fdb58b181fad7f97bfef7fd905d8ba3dcf39bb84 Patch is also attached.
Subject: mail-transport-imap4-internaldate.patch
diff --git a/lib/Mail/Transport/IMAP4.pm b/lib/Mail/Transport/IMAP4.pm index ed0fe8c..b17e3ab 100644 --- a/lib/Mail/Transport/IMAP4.pm +++ b/lib/Mail/Transport/IMAP4.pm @@ -464,12 +464,13 @@ sub fetch($@) sub appendMessage($$) -{ my ($self, $message, $foldername) = @_; +{ my ($self, $message, $foldername, $date) = @_; my $imap = $self->imapClient or return (); $imap->append_string ( $foldername, $message->string , $self->labelsToFlags($message->labels) + , $date ); }
Subject: Re: [rt.cpan.org #79680] Add internaldate support to Mail::Transport::IMAP4
Date: Mon, 17 Sep 2012 09:20:44 +0200
To: Daniel Westermann-Clark via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <secretaris [...] nluug.nl>
* Daniel Westermann-Clark via RT (bug-Mail-Box@rt.cpan.org) [120917 05:17]: Show quoted text
> Mon Sep 17 01:17:00 2012: Request 79680 was acted upon. > Transaction: Ticket created by DANIELTWC > Queue: Mail-Box > Subject: Add internaldate support to Mail::Transport::IMAP4 > Broken in: 2.106 > Severity: (no value) > Owner: Nobody > Requestors: danieltwc@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=79680 > > > I'm importing mail into an IMAP server using Mail::Box and found that the > server was reporting the time each message was appended to the folder as > when it was received.
Good idea. The implementation needs some work, for instance because the Mail::Box::IMAP4 implementation is not complete. So, to integrate this with Mail::Box, we should . implement appendMessage() in Mail::Box::IMAP4 (as all other backends have) Simple to implement, but I have no IMAP4 server myself to test it (and enough other projects on my hands) . try to extract the default date from the fromLine when available (the separator line in Mbox files) However, this may not be available, because the message get's coerced into a IMAP message before appendMessage is called. On the other hand, we may need to add this date into into the Mail::Box::IMAP4::Message object as well. . as fallback, try to extract the date from the Received headers automatically. Something like my @rgs = $msg->resentGroups; my $date = @rgs ? $rgs[0]->received : undef; I like the library to do the best thing, not to lazily depend on the main program to understand the World. Show quoted text
> sub appendMessage($$) > -{ my ($self, $message, $foldername) = @_; > +{ my ($self, $message, $foldername, $date) = @_; > my $imap = $self->imapClient or return (); > > $imap->append_string > ( $foldername, $message->string > , $self->labelsToFlags($message->labels) > + , $date > ); > }
This patch is taken. I have updated the docs as well. I hope you have to time to spend on above additions. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #79680] Add internaldate support to Mail::Transport::IMAP4
Date: Mon, 17 Sep 2012 09:28:57 +0200
To: Daniel Westermann-Clark via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <secretaris [...] nluug.nl>
* Mark Overmeer (secretaris@nluug.nl) [120917 09:20]: Show quoted text
> * Daniel Westermann-Clark via RT (bug-Mail-Box@rt.cpan.org) [120917 05:17]:
> > Mon Sep 17 01:17:00 2012: Request 79680 was acted upon. > > Transaction: Ticket created by DANIELTWC
Oh, I forgot one more: . we should be able to specify the date as time-stamp, having it automatically coverted into the right date format for IMAP4. I have added: $date = $imap->Rfc_822($date) if $date && $date !~ /\D/; -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
added to 2.107