Sending mail from access using Lotus Notes

M

Mike

Company uses Lotus Notes (R5) for it's mail. I'm building a database using
access 97. Boss wants automated reports to be sent via email once certain
critera is met.

I found a solution for Outlook, however I'm unable to find anything
utilizing Lotus notes. I can call up the program from Access with some
prefilled info, but I'm looking for a complete automated solution (i.e.
press a Command button and everything is done in background)

Any Help is appreciated. Thanks!
 
M

MA

Mike said:
Company uses Lotus Notes (R5) for it's mail. I'm building a database
using access 97. Boss wants automated reports to be sent via email
once certain critera is met.

I found a solution for Outlook, however I'm unable to find anything
utilizing Lotus notes. I can call up the program from Access with
some prefilled info, but I'm looking for a complete automated
solution (i.e. press a Command button and everything is done in
background)

Any Help is appreciated. Thanks!

Jump the mail client and use cdo.dll

--
_ _
Ciao
MAssimiliano Amendola www.accessgroup.it
Cisa - Conferenza Italiana per Sviluppatori Access
Info: www.donkarl.com/it
 
M

Mike

Thanks for the response, however I've had no experience using CDO.dll --
Are there any examples I can see or a more detailed explination of how this
would work?
 
G

Guest

Hey Mike

I use this code with A97 and Notes 6, hopefully it will work for notes 5

You'll need to set a reference to the notes library, do a search for
notes32.tlb on your local machine, Add through Tools->References->Browse and
select the file. This appears in the references list as 'Lotus Notes
Automation Classes'

'Sends an email from Lotus Notes client
Public Function SendNotesEmail(send_to As String, subject As String, message
As String) As Integer
On Local Error GoTo err_handler

Dim session As Object
Dim datab As Object
Dim Doc As Object
Dim sMsg As String
Dim server_name As String
Dim server_folder As String
Dim database_name As String

'Set default return value
SendNotesEmail = NO_ERRORS


'Get mail-in database settings (server, path and filename)
server_name = getPreference(MAIL_SERVER)
server_folder = getPreference(MAIL_PATH)
database_name = getPreference(MAIL_DATABASE)

'Start creating email
Set session = CreateObject("Notes.NotesSession") 'create notes session
Set datab = session.GETDATABASE(server_name, server_folder & "\" &
database_name)
Call datab.OPENMAIL 'set database to
default mail database
Set Doc = datab.CREATEDOCUMENT 'notesdocument '.New
'(db) ' create a mail document

'Fill in some basic fields
Call Doc.REPLACEITEMVALUE("SendTo", send_to)
Call Doc.REPLACEITEMVALUE("Body", message)
Call Doc.REPLACEITEMVALUE("From", email_address)
Call Doc.REPLACEITEMVALUE("Subject", subject)
Call Doc.REPLACEITEMVALUE("ReplyTo", email_address)

'Save a copy of the outgoing message -- this doesn't seem to work

' Call doc.Save(True)
' doc.SAVEMESSAGEONSEND = True

'Send the email
Call Doc.SEND(False) 'send the message

Set session = Nothing ' close connection
to free memory
Set datab = Nothing
Set Doc = Nothing

Exit Function
err_handler:
SendNotesEmail = err.Number
Resume Next
End Function

If you want file attachements, add these lines before the 'CALL doc.Send
(false)' line

'We need a rich text item to attach a file (.EmbedObject method is in
RichTextItem class)
Dim rtItem As Object
Set rtItem = Doc.CREATERICHTEXTITEM(Doc, "Body")
Call rtItem.EMBEDOBJECT(1454, "", PATH & "\" & file, "Label to appear as
attachment name")

HTH
 
S

SA

Mike:

Take a look at our PDF and Mail Library for Access. It interfaces with
Lotus Notes to allow you to pretty easily automate sending e-mails; if you
have any of the supported PDF drivers (and some quality ones are very in
expensive like Win2PDF) then you can automate the whole thing with very
little code. You'll find it in the developer tools area of our web.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top