Preserving Original Date when Importing EML Archive
By default, when ZCS imports a EML archive file using the GUI, it will take the date modified in the .eml file properties instead of the original Date on the message header. This issue has already been raised with bug 39838:
This is the expected behavior. Starting with ZCS 6.0.0, there is a new option to import a EML archive and preserve the original timestamp from each message. More information can be found by reading the REST API concept guide located at /opt/zimbra/docs/rest.txt (Upload options).
timestamp=0 do not use the archive entry date as the received date for msgs or the creation date for documents. Msg dates will be inferred from the Date header if available
Since this feature has not been implemented on the UI, we have to manually call the REST API from the command line.
Using zmmailbox with postRestURL:
- Copy your .zip EML archive file containing the eml archives to the zcs server (make sure you choose a temporary directory with plenty of enough space).
- Import your .zip EML archive file using the following command:
zmmailbox -z -m firstname.lastname@example.org postRestURL "inbox?fmt=zip×tamp=0&subfolder=/EML" /tmp/Eml-archive.zip
It will import the /tmp/Eml-archive.zip file into email@example.com EML subfolder, preserving the original timestamps.
Using zmmailbox with addMessage:
This method might be useful if there is a memory constraint when uploading/extracting a big zip file prior to processing each .eml file.
- Unzip Eml-archive.zip on a temporary directory of the ZCS server.
- With this method, there is no automatic creation of the folder, so you might want to create it first on ZCS (using EML as an example).
- Go to the same directory where you extracted the Eml-archive.zip and run the following command:
for i in *.eml ; do zmmailbox -z -m firstname.lastname@example.org addMessage /inbox/EML $i ; done
It will import all the .eml files into email@example.com EML subfolder, preserving the original timestamps. This could take more time, depending on the number of messages and respective size.
--Fmarques 13:27, 13 July 2010 (UTC)