Ajit Singh
Registered User.
- Local time
- Today, 12:14
- Joined
- Jul 11, 2013
- Messages
- 34
Hi
Am using MS Access 2010 to send huge bunch of emails from Lotus Notes. Below is the code am using but emails are not getting saved in the Sent folder of Lotus Notes.......email appears in Sent folder for a short period of time and then gets moved to Inbox. Pleas help
Dim objAttachment As Object
Dim objMailDb As Object
Dim objMailDocument As Object
Dim objEmbedObject As Object
Dim objNotesSession As Object
Dim strMailDbName As String
On Error Resume Next
'Start objNotesSession in Lotus Notes
Set objNotesSession = CreateObject("Notes.NotesSession")
'Open the mail database in Lotus Notes
strMailDbName = "mail\s\sin21757.nsf"
Set objMailDb = objNotesSession.GETDATABASE("", strMailDbName)
objMailDb.OPENMAIL
'Set up the new mail document
Dim rst As DAO.Recordset
Dim strLotusNotesUserID As String
Set rst = CurrentDb.OpenRecordset("list", dbOpenSnapshot)
With rst
Do Until .EOF
strLotusNotesUserID = !sendto
'-------------------------------------------------------
Set objMailDocument = objMailDb.CREATEDOCUMENT
objMailDocument.Form = "Memo"
objMailDocument.principal = "FP&A Central Support/FluorCorp"
objMailDocument.sendto = Split(strLotusNotesUserID, ",")
objMailDocument.Subject = "Test" 'strMailTitle
objMailDocument.Body = "NEW EMAILING DATABASE TESTING." 'strTextBody
objMailDocument.SAVEMESSAGEONSEND = True
'Set up the embedded object and strFileAttachment and attach it
If strFileAttachment <> "" Then
Set objAttachment = objMailDocument.CREATERICHTEXTITEM("strFileAttachment")
Set objEmbedObject = objAttachment.EMBEDOBJECT(1454, "", strFileAttachment, "strFileAttachment")
End If
'Send the document
objMailDocument.PostedDate = Now()
objMailDocument.send 0, Split(strLotusNotesUserID, ",")
'objMailDocument.Save True, True, False
'CreateObject("Notes.NotesUIWorkspace").EDITDOCUMENT True, objMailDocument
'objMailDocument "> " & Subject
'Clean Up
Set objMailDb = Nothing
Set objMailDocument = Nothing
Set objAttachment = Nothing
Set objNotesSession = Nothing
Set objEmbedObject = Nothing
'End Sub
'-------------------------------------------------------
.MoveNext
Loop
.Close
End With
Set rst = Nothing
Am using MS Access 2010 to send huge bunch of emails from Lotus Notes. Below is the code am using but emails are not getting saved in the Sent folder of Lotus Notes.......email appears in Sent folder for a short period of time and then gets moved to Inbox. Pleas help
Dim objAttachment As Object
Dim objMailDb As Object
Dim objMailDocument As Object
Dim objEmbedObject As Object
Dim objNotesSession As Object
Dim strMailDbName As String
On Error Resume Next
'Start objNotesSession in Lotus Notes
Set objNotesSession = CreateObject("Notes.NotesSession")
'Open the mail database in Lotus Notes
strMailDbName = "mail\s\sin21757.nsf"
Set objMailDb = objNotesSession.GETDATABASE("", strMailDbName)
objMailDb.OPENMAIL
'Set up the new mail document
Dim rst As DAO.Recordset
Dim strLotusNotesUserID As String
Set rst = CurrentDb.OpenRecordset("list", dbOpenSnapshot)
With rst
Do Until .EOF
strLotusNotesUserID = !sendto
'-------------------------------------------------------
Set objMailDocument = objMailDb.CREATEDOCUMENT
objMailDocument.Form = "Memo"
objMailDocument.principal = "FP&A Central Support/FluorCorp"
objMailDocument.sendto = Split(strLotusNotesUserID, ",")
objMailDocument.Subject = "Test" 'strMailTitle
objMailDocument.Body = "NEW EMAILING DATABASE TESTING." 'strTextBody
objMailDocument.SAVEMESSAGEONSEND = True
'Set up the embedded object and strFileAttachment and attach it
If strFileAttachment <> "" Then
Set objAttachment = objMailDocument.CREATERICHTEXTITEM("strFileAttachment")
Set objEmbedObject = objAttachment.EMBEDOBJECT(1454, "", strFileAttachment, "strFileAttachment")
End If
'Send the document
objMailDocument.PostedDate = Now()
objMailDocument.send 0, Split(strLotusNotesUserID, ",")
'objMailDocument.Save True, True, False
'CreateObject("Notes.NotesUIWorkspace").EDITDOCUMENT True, objMailDocument
'objMailDocument "> " & Subject
'Clean Up
Set objMailDb = Nothing
Set objMailDocument = Nothing
Set objAttachment = Nothing
Set objNotesSession = Nothing
Set objEmbedObject = Nothing
'End Sub
'-------------------------------------------------------
.MoveNext
Loop
.Close
End With
Set rst = Nothing