Linux: opening email messages in your desktop email client.

Recoll indexes email messages stored under the diverse possible storage formats (mbox multi-message files format variations, or single message per file).

Searching for or previewing the messages inside the Recoll interface does not present specific problems.

However, you will sometimes want to open the message in your favorite email client (Evolution, Thunderbird, Claws-mail, etc.). Doing this is unfortunately not straightforward because most email clients are not designed to be controlled from an external application.

The following lists the possible approaches for a number of common local email agents.

The MIME type for email messages, message/rfc822, is not processed specially by the default Recoll configuration so that the default desktop "File Open" method will be used for the messages, which is actually quite unlikely to work.

You will need to do two things to set things up for your email client:

  • Add message/rfc822 to the exceptions to Desktop preferences

  • Configure the command to use for opening the messages

This can be done using the GUI:

Preferences->GUI Configuration->User interface->Choose editor applications

Then select message/rfc822 check Exception to Desktop preferences and enter the command.

It can also be done by editing the mimeview file inside the index configuration directory (e.g. ~/.recoll/mimeview):

# Add message/rfc822 to the exceptions. There may already be other types in there, just add it to
# the list then.
xallexcepts+ = message/rfc822

[view]
# Example with evolution. Enter the appropriate command instead
message/rfc822 = evolution mid:%(msgid)

Evolution

This only works for messages managed in the evolution storage area, of course.

In order to use this, you must tell recoll to extract and store the Message-Id email header.

Edit the fields file in the configuration directory (e.g. ~/.recoll/fields) and add the following, or insert in appropriate sections if they already exist:

[stored]
msgid=
[mail]
Message-Id = msgid

Then use the following in the mimeview file (or use the GUI with the same data):

xallexcepts+ = message/rfc822

[view]
message/rfc822 = evolution mid:%(msgid)

Thunderbird

It used to be that you could just add the following to the mimeview:

[view]
application/x-mimehtml    thunderbird -file %f
message/rfc822            thunderbird -file %f
text/x-mail               thunderbird -file %f

However, recent versions of Thunderbird will only open a single-message file if it has a .eml extension, else they will open a 'create message' window with the file as an attachment. So we now use an intermediate shell script to create a symbolic link with a ".eml" extension. The script is named thunderbird-open-message.sh and it is in the filters directory for recent (future at this point) Recoll versions, or you can find it in the Recoll source repository.

Then set up mimeview with:

xallexcepts+ = message/rfc822

[view]
message/rfc822 = thunderbird-open-message.sh %f

Sylpheed

"sylpheed %f" seems to work ok as of version 3.3

Kmail

"kmail --view %u" works

Claws-mail

I could only get things to work with Claws in POP3 mode, not for IMAP.

  • In the Claws GUI, create a bogus folder, e.g., RecollTemp

  • Use a small intermediary shell-script, to be set as the viewer in mimeview:

#!/bin/bash

fn=$1

# You may  have to adjust the claws-mail storage location according to your setup
CLAWSMAIL=~/Mail

# If this message is inside the claws storage area, just select it
if test `expr "$fn" : "${CLAWSMAIL}"/'.*'` -ne 0;then
    claws-mail --select "$fn"
else
    tmp="${CLAWSMAIL}/RecollTemp/1"
    cp $1 "${tmp}"
    claws-mail --select "${tmp}"
fi