Rambou / TXT-to-Mbox

Converting txt files into a unique mbox file.
MIT License
0 stars 0 forks source link

Date not working #1

Closed 666173742d636174 closed 7 years ago

666173742d636174 commented 7 years ago

DateFormat is returning null. Unknown solution.

Rambou commented 7 years ago

@fast-cat Please can you upload a your sample TXT file? I had similar issues when i was implementing the code for my own. This code is made solving a specific kind of data in a .txt file, so please provide more info.

666173742d636174 commented 7 years ago

@Rambou This is currently the example .txt file I'm trying to convert (with emails in less-than-greater-than brackets):

From: Mark Smith marksmith@gmail.com To: John Doe johndoe@gmail.com Subject: Greetings Date: 04/05/1990 10:30 PM

Hello.

I've tried multiple different versions of the date format. Everything except the date is converted correctly. The date remains "12/21/1969 19:00" every time.

Rambou commented 7 years ago

You are right. For the record, code i had posted used to convert .txt generated files from "importexport tools" (thunderbird). So it wasn't meant to work with every txt file that contain an email without tweaking it at least a little bit. I'm working on a solution on this based on your example.

Also please inform me of how these .txt files, you have, have been generated. That way i'll know if the solution i'll provide be general.

Also check the last commit and the input/output files in test in which everything works fine.

Thanks in advance.

666173742d636174 commented 7 years ago

My .txt files were converted from Gmail takeout .mbox files. I am trying to convert them back to .mbox files. I've also tried manually making fake test emails, like the one provided above, that are written in mboxo format to see if that would work, but it hasn't.

Thank you for working on the problem.

Rambou commented 7 years ago

I've tested my script with the .txt you gave me and it worked like a charm. Please let me know if my script "as it is" works for you.

666173742d636174 commented 7 years ago

The script as is seems to only work when the mbox file is opened in Mozilla Thunderbird. When opened in any other mbox viewer program, the date is still not shown correctly.

Rambou commented 7 years ago

@fast-cat I've build this script with Thunderbird and GMail in mind. Though it should work with any mbox viewer because i've followed the mbox RFC.

This is an example of content in MBOX file type.

From MAILER-DAEMON Fri Jul 8 12:08:34 2011 From: Author author@example.com To: Recipient recipient@example.com Subject: Sample message 1

This is the body.

From (should be escaped). There are 3 lines.

From MAILER-DAEMON Fri Jul 8 12:08:34 2011 From: Author author@example.com To: Recipient recipient@example.com Subject: Sample message 2

This is the second body.

If you read this wiki you'll understand that most app using their own modified version of mbox so this maybe the reason date doesn't work with the specific mbox viewer you're using. Although it's maybe a frustration idk. My suggestion is to use another or modify existing code to make it work with it (and then share the script with us by forking pushing it :stuck_out_tongue:)

I'm going to close this issue because it's not a bug. It's rather an enhancement to work with other revisions of mbox files which they are not included in the official RFC. Although, to avoid any further frustration, i'm going to update README informing people that it's made to work at least with Thunderbird and GMail mbox files.