MikeC14081972
Programmer
Firstly Hello as this is my first post.
I have a module in Access which generates an email in the users 'Drafts' folder in Lotus Notes and attaches any necessary documents.
The problem I'm having is with the users signature which I can not for the life of me get to appear on the outgoing email. The signature is an HTML file and their Notes set up is set to attach to all outgoing emails.
Below is the code I'm using without any db specific settings. Does anyone know how I can get the signatures to appear.
Many Thanks.
I have a module in Access which generates an email in the users 'Drafts' folder in Lotus Notes and attaches any necessary documents.
The problem I'm having is with the users signature which I can not for the life of me get to appear on the outgoing email. The signature is an HTML file and their Notes set up is set to attach to all outgoing emails.
Below is the code I'm using without any db specific settings. Does anyone know how I can get the signatures to appear.
Many Thanks.
Code:
Public Function SendEmail(SendTo As String, _
MsgSubject As String, _
Optional MsgBody As String, _
Optional AutoSend As Boolean = False, _
Optional AttachFileName As String) As Integer
Const EMBED_ATTACHMENT As Long = 1454
'Dim EMailAddress As Variant
Dim i As Integer
Dim Msg As String
Dim objNotesDB As Object 'NOTESDATABASE
Dim objNotesDoc As Object 'NOTESDOCUMENT
Dim objNotesRTF As Object 'NOTESRICHTEXTITEM
Dim objSession As Object 'NotesSession
On Error GoTo Err_Handler
Set objSession = CreateObject("Notes.NotesSession")
Set objNotesDB = objSession.GetDatabase("", "")
'Open Lotus mail.
objNotesDB.OPENMAIL
If (objNotesDB.IsOpen) Then
'Create a new mail message.
Set objNotesDoc = objNotesDB.CreateDocument
objNotesDoc.ReplaceItemValue "Sendto", SendTo
objNotesDoc.ReplaceItemValue "Subject", MsgSubject
'Add the body text.
Set objNotesRTF = objNotesDoc.CreateRichTextItem("body")
objNotesRTF.AppendText MsgBody
objNotesRTF.addnewline 2
'Attach the export file.
If (AttachFileName <> "") Then
objNotesRTF.EMBEDOBJECT EMBED_ATTACHMENT, "", AttachFileName,
AttachFileName
End If
'Gets the mail to appear in the sent items folder
objNotesDoc.SAVEMESSAGEONSEND = True
objNotesDoc.Save True, True
'Send the message.
If (AutoSend) Then
objNotesDoc.PostedDate = Now()
objNotesDoc.Send False
End If
Set objNotesRTF = Nothing
Set objNotesDoc = Nothing
'Return success.
SendEmail = True
Else
Msg = "Lotus mail could not be opened."
MsgBox Msg, vbInformation
'Return failure.
SendEmail = False
End If
Set objNotesDB = Nothing
Set objSession = Nothing
Exit Function
'*****************************************
Err_Handler:
'Report the error.
MsgBox Error, vbCritical
If (Not objSession Is Nothing) Then
Set objSession = Nothing
End If
'Return failure.
SendEmail = False
Exit Function
End Function