Display .eml file in web server

Hi. I’m using DT to backup et sort email files.
I’m trying to run the web server so that other people could access the database.
But the mail file format .eml can’t be displayed in safari (nor firefox)

Is there any tip to do the job?

Or is it possible to import emails in RTFD file format instead of eml automatically?

One possibility is to convert them to rich text after importing and to remove the originals (if desired).

That’s a solution but there is one (major) problem with it:
The creation/modification date are set to the time when I make the conversion.
I’d preferred that the date stay the same as the original, in order to sort emails by reception date which is no longer possible.

Here’s a script which retains tags, replicants, dates, labels and flags:


-- Convert documents to rich text
-- Created by Christian Grunenberg on Tue Feb 03 2009.
-- Copyright (c) 2009-2011. All rights reserved.

tell application id "com.devon-technologies.thinkpro2"
	set theSelection to the selection
	if theSelection is not {} then
		try
			show progress indicator "Converting..." steps (count of theSelection)
			repeat with theRecord in theSelection
				set theName to (name of theRecord)
				step progress indicator theName
				try
					-- Retains tags & replicants without specifying a destination group
					set theConvertedRcord to convert record theRecord to rich
					-- Retain dates, label & flag
					set creation date of theConvertedRcord to creation date of theRecord
					set modification date of theConvertedRcord to modification date of theRecord
					set label of theConvertedRcord to label of theRecord
					set state of theConvertedRcord to state of theRecord
				end try
			end repeat
			hide progress indicator
		on error error_message number error_number
			hide progress indicator
			if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
		end try
	end if
end tell

Just select the messages and run this script.

Is this still the only way?

And: If I use this script, the originator of the mail is not migrated to the new file. Any idea?

Oh, and another question:

At the end of the Name of the converted files there is an " Text". In the script there’s for me no reason, why this is so.

That’s automatically appended by the “convert record” command which is identical to Data > Convert > To Plain/Rich Text. But you could insert these lines to retain the URL & name:


set URL of theConvertedRcord to URL of theRecord
set name of theConvertedRcord to name of theRecord

This works fine. I will try now to understand why this helps :wink:

Could you answer the other question above “And: If I use this script, the originator of the mail is not migrated to the new file. Any idea?”

I’ve just checked this but the URL of the original and the converted email are identical and the converted email contains the sender/receiver. Any hint which information is missing where? E.g. a screenshot might be useful. Thanks!

Hi!

Here is the attachement:

First Dataset: the eml-File
Second Dataset: the converted file

The Value for “Von” is missing in the second dataset. Also the others values like Absender, Von, Titel, Betreff are missing

I’m using your script:

-- Convert documents to rich text
-- Created by Christian Grunenberg on Tue Feb 03 2009.
-- Copyright (c) 2009-2011. All rights reserved.

tell application id "com.devon-technologies.thinkpro2"
	set theSelection to the selection
	if theSelection is not {} then
		try
			show progress indicator "Converting..." steps (count of theSelection)
			repeat with theRecord in theSelection
				set theName to (name of theRecord)
				step progress indicator theName
				try
					-- Retains tags & replicants without specifying a destination group
					set theConvertedRcord to convert record theRecord to rich
					-- Retain dates, label & flag
					set URL of theConvertedRcord to URL of theRecord
					set name of theConvertedRcord to name of theRecord
					set creation date of theConvertedRcord to creation date of theRecord
					set modification date of theConvertedRcord to modification date of theRecord
					set label of theConvertedRcord to label of theRecord
					set state of theConvertedRcord to state of theRecord
				end try
			end repeat
			hide progress indicator
		on error error_message number error_number
			hide progress indicator
			if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
		end try
	end if
end tell

This information is part of the converted rich text (as rich text documents don’t support such properties).

Hmm, ok. So there is no way (after converting the mails) to group the datasets by the value “von” or any other value of the mail?

You could try to use a smart group like Content matches “Von …”, the phrase should usually return the desired results and almost no false results.

Are there any plans to implement eml-compatibility to the webserver?

The was to convert the mails via script ist not very practicable.

This really is a question of browser technology. (Not saying it couldn’t be done but that it is an inherent limitation of browser tech.)