Send E-Mail Using Lotus Notes - March 2006

We have been using Lotus Notes code in a commercial application for a few years. It has been reported that there may be some 'unknown' instances where the code does not work properly. The code uses Lotus Notes automation to send e-mail with attachments. We are placing the code in the public domain hoping that you will use the code and report any problems so it can be corrected. I created this 'demo' to illustrate the use of the code. Some parts of the code rely on an earlier tip-of-the-month called: "Send E-Mail Using Shell". Click here to view that tip. Most of the useful code is contain in class module 'cNotesEMail.cls'. Please send comments or corrections to

Demo Program

I wrote a VB6 demo program to illustrate the use of the class. The demo:

Send E-Mail using Lotus Notes

Caption - The caption contains the name of the registered Notes object. It is obtained by using method 'IsRegistered' - see below.

From - The from address, your address, is obtained using an e-mail address found in the registry. See class module 'cDefaultEMailAddress' below for details.

To - Enter the recipient e-mail addresses, separated by semi-colons.

CC - Enter the 'copy to' recipient e-mail addresses, separated by semi-colons. Optional.

BCC - Enter the 'blink copy to' recipient e-mail address, separated by semi-colons. Optional.

Subject - Enter the e-mail's subject.

Body - Enter the body text of the message.

Attachment - Enter the fully qualified file name of the attachments, separated by semi-colons. Use the browse button to find a file. Optional.

Send Mail - Click this command button to send the e-Mail via Lotus Notes.

Sample Calling Code

See: Send E-Mail Using Shell for the udtEMail structure.

Sample Lotus Notes Message

Sample Lotus Notes Message

Class cNotesEMail Methods and Properties

Object Browser
Properties and Methods

Methods/Properties Operands Sample Comment
.IsRegistered <none> .IsRegistered Sets the Notes.exe in .Filename
.Filename     c:\Program Files\lotus\notes\notes.exe
.SendEMail sTo, sSubject, sAttachment, sBody[, sCC][, sBCC][, bSaveIt] .SendMail sTo, sSubject, "", sBody  
 sTo   "" Recipients separated by semi-colons.
 sSubject   "My Notes E-Mail" The subject of the e-mail.
 sAttachment   "c:\autoexec.bat; c:\config.sys" Attachments separated by semi-colons.
 sBody   "Meeting at 3:30 in conference room." The text of the message.
 sCC Optional Same as sTo Copy to.
 sBCC Optional Same as sTo Blind copy to.
 bSaveIt Optional True/False Save message on send. Default is False

The Demo Program Uses These Modules

Module - Click for More Info Description Used in the Demo To
cNotesEMail.cls Send e-Mail using Lotus Notes The subject of this tip.
Include in your application.
modEMailNotes.bas Support e-Mail using Lotus Notes Include in your application.
modEMail.bas Generic e-Mail support Include in your application.
modRegisteredObject.bas Test for object registered Used to determine if Notes is registered.
Include in your application.
modReg.bas Read the registry. Used by modRegisteredObject.
Include in your application.
cDefaultEMailAddress.bas Get your default e-Mail address. Used by the demo program
Not needed in your application.
CDialog.cls Browse for file. Find attachments. Not needed in your application.
modLocationLocationLocation.bas Form Housekeeping Set form size and location.
Not needed in your application.
modConnectToWebSite.bas Connect to a web site Show this info when Help/Info is
selected from the demo.
modInfoAbout.bas DoInfo, DoAbout, DoTip Link to this page and provide helpful information.

Download VB Code

Click here to download the VB 6 source code [33k].

Previous Tip   Tip Index   Next Tip


Updated 2006/07/16