Home > Domino Tips > Developer > Exporting email from Lotus Notes to .EML messages
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

Exporting email from Lotus Notes to .EML messages


Arthur Turner
05.31.2006
Rating: -4.10- (out of 5)


Lotus Notes and Domino tips, tutorials and how-to articles
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


VIEW MEMBER FEEDACK TO THIS TIP

Have you ever wanted to store your email in a file system, but still be able to keep the whole context of the email together? This tip will enable you to extract individual mail items and store them in a file system. The file created can be read directly from Microsoft Outlook and keeps all the internal integrity. Attachments are stored inside the message as MIME encoded attachments. The only problem I have had is with email sent from MAC, which I assume is due to the encoding used.

There are just two parts to this. The first is some LotusScript that is called from an action. The second is a form that helps in the conversion. Much of this code has been cribbed from the internet, so I want to thank all those that produced some of the original code. All of the examples I found did part of the job, but did not go all the way; and the only other option was to go for a package solution, which was expensive and also did not quite meet what I was searching for.

This form has just two fields. The first is MimeRichTextField. This should be set to store contents as HTML and MIME and is a RichTextField, which is also editable. The second field is called HtmlText and is also an editable RichText field. Let it be known that this is a standard Lotus Notes Richtext field. The form should be called MimeConvert and created in the mail file or mail file template.

The LotusScript code below should be copied into an agent. Run it from the action menu and on all selected documents.


MEMBER FEEDBACK TO THIS TIP

We have had lots of responses about this tip, with our users saying that there are too many line breaks in the code for it to work. Here you will find the code in its original format, as I received it from the tip author. Hope it works for everyone.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
E-mail
Secure Lotus Notes/Domino 8.x from mail to unknown recipients
Domino server setting and email policy tricks admins must know
Top 10 Lotus Notes/Domino administration tips of 2008
Can Lotus Notes/Domino and Microsoft SharePoint play nice together?
Using Formula language code to sort Lotus Notes messages by subject
LotusScript action button manages Lotus Notes mail files
Exploring Lotus Notes Domino 8.0.1 and beyond
LotusScript agent moves tagged spam email to junk mail folder
Send SMS text messages between Lotus Notes 7 and mobile devices
Update to Exchange Server 2003 Connector for Lotus Notes

Agent
Run or restart Notes/Domino agents via text messages
Approve Lotus Notes documents using a BlackBerry mobile device
LotusScript agent indexes Lotus Notes/Domino databases
Open documents in Lotus Notes from the Web without a UNID
Fix and update Lotus Notes documents with limited access
Verify scheduled agent status with Domino Extensible Language (DXL)
How to export data from a Lotus Notes database to a CSV file
Enable or disable scheduled agents without opening the Lotus Notes database design
Creating custom views in Lotus Notes databases
Editing fields in a Lotus Notes view with Ajax

LotusScript
LotusScript agent parses ACL to Microsoft Notepad
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management
LotusScript agent automates selective mail file replication

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


r>—Matt Gervais, SearchDomino.com Assistant Site Editor

******************************************

When copying the code to an agent, how do I control which sections of the code end up in which module in Domino Designer? The sections are not separated or labeled clearly and when pasted into any single module in a new agent the sections, they do not separate consistently nor into the correct modules such as (Options), (Declarations), (Initialize), etc. Also, what is the output file of this code and can the output be read by a browser or other application?
—Dave O.

******************************************

You should open the attached file and do the following:

This will create all the functions and set up the declarations and Initialize Sub.

As for the output file, the file that gets created is an .EML file which appears to be a generic email format. Microsoft Outlook reads it fine as is. The format can also be read by a number of other readers.
—Arthur Turner, tip author.

******************************************

I've updated the above link with a new text file straight from the tip's author, Arthur Turner. He says it is the best way to look at it and it formats the LotusScript the best way. Please feel free to email me with any further questions or comments regarding this tip.
—Matt Gervais, SearchDomino.com Assistant Site Editor

******************************************

The attachments in the subject email, documents do not appear in the exported .EML files. Instead, Microsoft-Outlook Express displays the following message: "OE removed access to the following unsafe attachments in your mail: "

There does not seem to be a way to get at the attachment. The Outlook behaves the same way with all attachments that I've tested, regardless of file type. Since I am unfamiliar with Microsoft Outlook, I'm uncertain if this is caused by some sort of security setting to be found someplace in Outlook or another related Microsoft application.

What I am really trying to do is select a large number of documents in a database and then print all the documents plus their attachments to a .PDF file or any generic file format. Since Notes/Domino does not provide a way to do this directly, it seems that there would be many users out there who would need to do this. I think that not only I, but indeed the whole SearchDomino.com community would find a resolutions to this Notes/Domino limitation to be a very helpful and useful enhancement.
—Dave O.

******************************************

I think the problem is caused by Outlook Express itself. One of the security settings is to remove files that may cause security concerns, good old Microsoft thinking for you as always. The setting to fix this is in Tools/Options, security tab virus protection section and untick the option 'Do not allow attachments to be saved or opened that could potentially be a virus'
—Arthur Turner, tip author.

******************************************

I disabled the security setting so that the file attachments are now accessible in Outlook Express. However, the fundamental problem remains in that I cannot find a way to print a massive quantity of documents, plus their attachments, so it appears I have traded a Notes/Domino limitation for a MS-Outlook Express limitation.
—Dave O.

******************************************

I was looking at the code that the author sent you. I noticed that there are three lines missing in the print. When I pasted in the code; the lines below in bold appeared, yet they are not in his article code. Any Idea what this horizondmsave.exe is?
—Frank M.

******************************************

This code relates to a document management system. The code allows us to launch into it directly. As this was not necessary, I took it out of the original example.
—Arthur Turner, tip author.

******************************************

When I try to run the code provided, I receive an error message that says, "Cannot locate Form: MIMEConvert". Do you know how I should go about solving this? Also, do you know if it is possible to open the emails on another computer by installing Lotus Notes if I save my inbox as an .nsf file?
—Mavis H.

******************************************

This form has just two fields. The first is MimeRichTextField. This should be set to store contents as HTML and MIME, and is also a RichTextField -- which is also editable. The second field is called HtmlText, and is also an editable RichText field. Let it be known that this is a standard Lotus Notes Richtext field. The form should be called MimeConvert and created in the mail file or mail file template. This form should be designed in the mail database or template.

As for part 2 of his query, yes, you can copy a mail database and open it on another computer so long as the user ID is copied across as well.

Some suggestions might be to output the file named with Sender name and subject, or to change this line in code: to
—Arthur Turner, tip author.

******************************************

If I were to save the email content and attachment to an .EML file, can it be read by the Lotus Notes client?
—A.R.

******************************************

Unfortunately, the answer to your question is no. Lotus Notes will not be able to read these files unless they were presented as IMAP4, POP3 or native Lotus Notes format and I could not find out how to export individual mail items in Lotus Notes format.
—Arthur Turner, tip author

******************************************

I'm trying to run the agent and I keep receiving the same error message mentioned in the user comments: "Cannot locate Form: MIMEConvert."

While I have access to create agents, it would appear that I am not able to create/update forms. Is there a way to modify this script to run without an additional form?
—Todd B.

******************************************

Sorry, unfortunately I have not looked into this. The nice thing about the form is that it does the clever stuff in converting Richtext field to MIME. What you inquire about may be possible, but I think you are looking to pay for that type of tool and it requires some C programming.
—Arthur Turner, tip author

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip library by member Arthur Turner. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts