Lotus Notes email

cjones75

New member
Joined
Nov 17, 2014
Messages
1
Programming Experience
5-10
Hi,

I have written some code to send an email using the lotus notes domino.dll. The code works fine in the sense that it sends an email,
however the attachment part does not work. According to several tutorials, the code is correct and I am at a loss to what is the
problem. I would very much appreciate any help.

Here is my code:

Dim objNotesSession As Object
Dim objNotesMailDb As Object
Dim objNotesMailDoc As Object
Dim objNotesRTItem As Object
Dim ohjNotesRTAttacment As Object
Dim oEmbedObject As Object




Dim cstrAttachment As String


Try
cstrAttachment = "C:\Users\christopher.jones\Documents\SSL.txt"
objNotesSession = CreateObject("Notes.NOTESSESSION")


'Bind to mail database
objNotesMailDb = objNotesSession.GETDATABASE("XXXXXXXX", "names.nsf")
If Not objNotesMailDb.ISOPEN = True Then
objNotesMailDb.OPENMAIL()
End If


objNotesMailDoc = objNotesMailDb.CREATEDOCUMENT
Call objNotesMailDoc.REPLACEITEMVALUE("Form", "Memo")
Call objNotesMailDoc.APPENDITEMVALUE("SendTo", "christopher.jones@sita.aero")
Call objNotesMailDoc.REPLACEITEMVALUE("Subject", "test email")
Call objNotesMailDoc.REPLACEITEMVALUE("PostedDate", Now())


objNotesRTItem = objNotesMailDoc.CREATERICHTEXTITEM("Body")




If cstrAttachment <> "" Then
ohjNotesRTAttacment = objNotesMailDoc.CREATERICHTEXTITEM("Attachment")
oEmbedObject = ohjNotesRTAttacment.EMBEDOBJECT(1454, "", cstrAttachment, "Attachment")
objNotesMailDoc.CREATERICHTEXTITEM("Attachment")
End If




'Gets the mail to appear in the Sent items folder
objNotesMailDoc.SAVEMESSAGEONSEND = True
Call objNotesMailDoc.REPLACEITEMVALUE("PostedDate", Now())


'Send the document
'objNotesMailDoc.Send(0, Split(strTo, ";"))
objNotesMailDoc.Send(0, "christopher.jones@sita.aero")





MsgBox("Email Sent")
Catch ex As Exception
MsgBox(ex.Message)
Finally
objNotesMailDb = Nothing
objNotesMailDoc = Nothing
objNotesRTItem = Nothing
objNotesSession = Nothing

End Try





thank you,

Chris
 
Back
Top Bottom