Manage Learn to apply best practices and optimize your operations.

Send Email Through Outlook From Notes

Many of the enterprise solutions we have implemented involve sometype of
integration between the appplication we are introducing and the customer's
email system. If we are lucky the customer is using Notes as their messaging
system. Unfortunately, this is not always the case and we need to be able to
send from Outlook, or exchange, or some other messaging application. This code
was developed for such a purpose. For this example we are using Outlook 98 on
a Windows system but you could take this and use it (with some modification)
with any mail app.

This really works well for us, you can embelish this with adding attachments,
or sending without presenting to the enduser. We even have one customer where
we are sending the message with a word attachment that is protected for
revision on the fly.

You can really take this base code and go far with it!!

Good Luck!!
In an agent that is envoked by a form/view action or directly:

Initialize event:
Sub Initialize
Dim ws As New NotesUIWorkspace
Dim strMessageType As String

Set UIdoc = ws.currentDocument
UIdoc.AutoReload = False 'improves performance
Set doc = UIdoc.document

Call ForegroundOutlook()

End Sub

ForegroundOutlook Event:
Sub ForegroundOutlook ()
Const BYVALUE = 1 'this is used to attach the actual document not a link
for outlook

'Get an outlook application object
Set objSession = CreateObject("Outlook.Application")

'Create a new message
Set objMessage= objSession.CreateItem(olMailItem)

'Display the message interface to the user
objMessage.Display

'Set the subject and message fields
Subject$ = "This is the subject text fo this message"
Message$ = "This is the body text for this message"
QNumber = doc.ordernumber(0)

'The intPosition is used to determine the placement of the attachment in
the message. It is set the space
'immediately following the message.
intPosition = Len(Message$) + 1

Set objRecipient = objMessage.Recipients.Add (sendto)
objMessage.subject = Subject$
objMessage.Body = Message$

'NOTE: there is no send code since that will be done by the user when
'they complete editing / reviewing the message.

Exit Sub

End Sub

Dig Deeper on Domino Resources - Part 6

SearchWindowsServer
Search400
  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

SearchDataCenter
SearchContentManagement
Close