Check email header for RFC 822 standard and match emails between imap servers.

Vincent Davis vincent at vincentdavis.net
Thu Aug 18 19:53:35 EDT 2011


The sort story, I have been attempting to use the Google Migration assistant
to migrate emails from one google account to another, about 80,000 emails.
I have two problems.
1. Many emails that fail to transfer because of errors like "Invalid RFC 822
Message: Date header "Mon Feb 05 22:07:16 2007" is invalid." See
full error below.
 emails that.
2. I need to delete the emails from the old account that have been
transferred.

And the Two question are:
1:
I am able to connect and get an email. But I am not clear how I would check
that the header is valid or identify the problem.
grl = imaplib.IMAP4_SSL('imap.gmail.com', 993)
grl.login('name at domain.com', 'password')
grl.fetch(17006, 'uid')
# So now I have an email how do I check the header, I know how to view it
but not check it for RFC 822.

2:
Since I don't know which emails have been transferred I want to delete all
the email that have. To be more correct I don't know which ones on the old
account, when they are moved to the new account they get the label as
transferred. How should I compare emails? The uid is different on each
server so I think using the TO: FROM: and DATE: TIME: would work.
How do I compare emails in this way?
How to I get the TO: FROM: DATE: TIME: from one email to reach for the same
email in the other account.


Sample error from google migration app.

2011-08-16T16:47:47.141-06:00  808 E:Network
ExchangeMigration!WinHttp::ExecuteHttpRequestIStreamResponse @ 696 (
gmetanias at domain.com <gmetanias at glsworld.com>)> Response:

Invalid RFC 822 Message: Date header "Mon Feb 05 22:07:16 2007" is
invalid.

2011-08-16T16:47:47.141-06:00  808 E:Migration
ExchangeMigration!EmailUploader::HandleStatus @ 462
(gmetanias at domain.com<gmetanias at glsworld.com>)>
Permanent Message Failure, skipping the message!.

2011-08-16T16:47:47.328-06:00  808 E:Migration
ExchangeMigration!IMAPMessageWrapper::GetMessageSentTime @ 154 (
gmetanias at domain.com <gmetanias at glsworld.com>)> Failed with 0x80004005, last
successful line = 151.

2011-08-16T16:47:47.328-06:00  808 E:Migration
ExchangeMigration!IMAPMessageWrapper::GetMessageReceivedTime @ 170 (
gmetanias at domain.com <gmetanias at glsworld.com>)> Failed with 0x80004001, last
successful line = 168.

2011-08-16T16:47:47.328-06:00  808 E:Migration
ExchangeMigration!GetMessageDescription @ 198
(gmetanias at domain.com<gmetanias at glsworld.com>)>
Sent: 2011-08-16T22:47:47.000Z. Received: 2011-08-16T22:47:47.000Z. Size:
196114. Subject RE: ppt templates.


-- 
Thanks
Vincent Davis
720-301-3003
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110818/b4c87a50/attachment.html>


More information about the Python-list mailing list