views:

66

answers:

2

I've been able to send emails using Lotus Notes and VBA and Python using the COM API like this:

http://stackoverflow.com/questions/1027400/can-i-use-lotus-notes-to-send-mail

My question is how can I insert an image inline with the body text (not as an attachment) in a programmatic way (equivalent to the Edit | Paste Special)? I haven't been able to find any workable solutions from a few Google searches. Any solution using stock VBA or Python would be appreciated.

Thanks!

A: 

It should be possible to do this using the DXLImporter class, available from VBA through the COM interface. DXL is a Notes-specific XML, which you can generate to a temp file, then import into your database. There is sample code on this blog entry, which may be close to what you are looking for (this imports a rich-text body, including in-line image, and then attaches that rich text to a mail document).

http://www.cubetoon.com/2008/notes-rich-text-manipulation-using-dxl/

Other options you might consider are:

(1) using the C or C++ API's - definitely more effort, especially when working with rich-text, but would essentially have no limits. (http://www.ibm.com/developerworks/lotus/library/capi-nd/index.html)

(2) using the MIDAS Toolkit from Genii (http://www.geniisoft.com) - extends the Lotuscript API's and exposes much of what is in the C API.

Ed Schembor
+1  A: 

If you don't need to do anything specific to Notes, i.e. work with a specific form with @functions etc, then you are much better off constructing the message as a multipart mime message.

You need to set up the session so that when you create the document it is mime and you can then set up your message appropriatly, see NotesSession.ConvertMIME. You will then use NotesMIMEEntity and NotesMIMEHeader objects to construct the mime message.

If you are unfamilier with how mime messages are constructed then this is going to be a little tricky, so you may want to have a look at some raw mime messages to see what they look like. From there you should be able to work out how to use the api for the NotesMIMEEntity and NotesMIMEHeader classes to construct the message.

kerrr
This seems like the right path to me; although the API is complicated enough (even more so when trying to script it though straight COM with Python), I appreciate the push in the right direction. I'll post some code if I get it working.
Nicholas Palko