Import e-mail into SuperMemo from any application

From SuperMemopedia
Jump to navigation Jump to search
“Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.” —Zawinsky's law of software envelopment

Introduction

Incremental e-mail processing (See: E-mail, incremental reading, creativity, and time-management, and Incremental mail processing) embodies compelling elements. Currently, Microsoft Outlook (part of the Microsoft Office Suite) enjoys smooth support from SuperMemo through the Mail Import command (Edit : Mail Import). When using other e-mail readers, however, one must resort to importing the content of e-mail messages manually. The help article section, Importing mail from other applications explores ways to import messages from clients different from Outlook: it is possible to load individual messages from files in the EML format (as used by Outlook), or the system clipboard.

The present article expands on the possibilities granted by the system clipboard method, such that any application may be able to serve as message source for incremental mail processing in SuperMemo, subject to specific formatting requirements. Concretely, with the correct message source format, SuperMemo might be able to recognize key e-mail headers and transform them into references. When properly recognized, these references can be propagated to extracts during incremental processing, as well as allow the E-Mail or E-Mail FAQ (help) commands to send replies to the correct recipients.

Appropriate format for import

This format shall be referred to as «Outlook style». It is thus named because it resembles the formatting of user-visible e-mail headers in Microsoft Outlook or Outlook Express. Outlook style format is described by the following template:

----- Original Message -----
From: "Sender Name" [mailto:sender@server1.com]
To: "Recipient Name" [mailto:recipient@server2.com]
Sent: Date/time string
Subject: Message subject

Message body 

Note: In case the original message has no subject the string "(no subject)" is appended to Subject:.

Here is a concrete example:

----- Original Message -----
From: "Poliphylus" [mailto:poliphylus@hypnos.com]
To: "Polia" [mailto:polia@hypnos.com]
Sent: Thursday, February 25, 2010 8:55:27 PM
Subject: A dream

Dear Polia,

Here is a crystalline, voluminous description of my dream last night. . .

Result of e-mail import

When the content of a message satisfies the Outlook style, upon import:

The result of importing an e-mail into SuperMemo with New Article (Ctrl+N). Note that the header information has been automatically color-coded and separated from the body.
  • Subject: becomes #Title
  • From: becomes #Author
  • Date: becomes #Date
  • Header information will be automatically color-coded and separated from the body.

When sending a portion of text with E-mail or E-mail FAQ, the first address preceded by mailto: is used.

Importing e-mail: High-level steps

Todo: Determine which is the most convenient method under which circumstances (there is now the Paste e-mail command). Advice still dated 2010.

  1. Recreate the «Outlook style» message format from the original message.
  2. Copy the text to the clipboard.
  3. Import clipboard contents into Supermemo invoking the New Article command (Ctrl+N).
  4. Use incremental reading techniques to process imported texts.

Importing e-mail: Limitations

  • Attachments will not be imported into components in SuperMemo elements.

Importing messages from specific e-mail readers

Temporary caveat: Much of this advice was written in 2010 and is pending revision.

Here are tips for making the process more automated in specific e-mail readers.

Thunderbird

  1. Download and install these extensions: Change quote and reply format and ReFwdFormatter
  2. Access Tools : Add-ons : Extensions. Click on Change quote and reply format and select Options
  3. In the Reply header tab, select Customized reply header. Enter the following template:
----- Original Message -----
From: %%6 [mailto:%%7]
To: %%2 {{ and %%3 }}
Sent: %%5
Subject: %%4

  1. (optional) Adjust other preferences to your liking.
  2. Locate a message to import into Supermemo. Choose "Reply".
  3. Select all text (e.g. Ctrl+A) and import it into the clipboard (e.g. Ctrl+C)
  4. Switch to SuperMemo and import clipboard contents. (Ctrl+N)

Note: Works best when replying in plain text format.

RITLabs The Bat! (until version 7.99)

  1. Download Extended Macro Plugin (XMP) for The Bat!
  2. Unpack the archive to a folder, locate the file named XMP.tbp.
  3. In The Bat! go to Options : Preferences : PlugIns : Add
  4. Locate XMP.tbp and press OK.
  5. Open Quick Templates dialog. Tools : Quick Templates (Shift+Ctrl+Q)
  6. Create a new Quick Template with the following code:
%CLEAR%-
%_VarFrom=%IF:|%OFROMNAME|=|%OFROMADDR|:|%OFROMADDR|:|"%OFROMNAME" [mailto:%OFROMADDR]|%-
%CURSOR----- Original Message -----
From: %_VarFrom
To: %OTONAME [mailto:%OTOADDR]
Sent: %ODATEEN %OTIMELONGEN="h:nn AM/PM"
Subject: %OSUBJ%XMP_NoSubj("(no subject)")

%TEXT
  1. Give the Quick Template a memorable handle. (e.g. "sm") and save it.
  2. Locate a message to import into Supermemo. Choose "Reply".
  3. Type the handle (in this case, type "sm", without the quotes) and press Ctrl+Space. As a result, the reply stub will be erased and replaced by the message in "Outlook style".
  4. Select all text (e.g. Ctrl+A) and import it into the clipboard (e.g. Ctrl+C)
  5. Switch to SuperMemo and import clipboard contents. (Ctrl+N)

Sending e-mail

It is also possible to send e-mail from SuperMemo without Outlook. This requires an e-mail client which:

  • supports MAPI; at minimum, its simple implementation (Simple MAPI or SMAPI);
  • is properly registered with Windows through the registry.

Note: Simple MAPI can only produce plain text messages (as opposed to HTML, or rich-text message bodies).

Ensuring MAPI is configured

Traditionally, applications set as the default e-mail client are also set as the default MAPI handler, thereby activating MAPI. However, in recent editions of Windows, MAPI may not be necessarily configured.

One can verify that MAPI is enabled through the registry. The exact registry subkeys vary according to the bitness of the operating system (32-bit or 64-bit). In either case, there must be a string value named MAPI with the value 1.

  • 32-bit: Under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem\
  • 64-bit: Under HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Messaging Subsystem\

The following exemplary registry files enable MAPI:

  • 32-bit: enable_mapi_mail_win32.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem]
"MAPI"="1"
  • 64-bit: enable_mapi_mail_win64.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Messaging Subsystem]
"MAPI"="1"

One of these files should be merged into the registry (e.g. by right-clicking the file entry in Windows Explorer and choosing Merge from the context menu).

It is also possible configure MAPI interactively through GUI: demo (for Windows 10, 64-bit).

More information: Why does "send current element via email" not work, despite MAPI-compatible MUA? (FAQ)

Partial list of MAPI-compliant software

E-mail readers that comply with MAPI (or a subset thereof) are able to send e-mail originating from SuperMemo.