We are currently converting from Lotus Notes to Outlook express for our Email program. I have logic in place that uses Lotus notes to email reports out of Access, But does anyone have logic for outlook express? I will attach my Lotus Notes logic. Also has anyone else ever used any Mapi logic to send out Emails from Access? Thanks for any help.
Sub EMailUsingLotusNotes(strSubject As String, strFile As String, _
strAddress As String, Optional strCopyTo As String, Optional strBody As String)
On Error GoTo Err_EMailUsingLotusNotes
' Sends simple email using Lotus Notes
' Does NOT Require Reference to Lotus Notes Object Library
' does not save to users sent box
Dim LotusSes As Object ' Lotus Notes Session
Dim LotusDbs As Object ' Lotus Notes Database
Dim LotusDoc As Object ' Lotus Notes Document
Dim LotusItem As Object ' Lotus Notes RichTextFile
Dim AttachedFile As Object ' Attachment
Set LotusSes = CreateObject("Notes.NotesSession")
Set LotusDbs = LotusSes.GETDATABASE("", "")
LotusDbs.OPENMAIL
Set LotusDoc = LotusDbs.CREATEDOCUMENT()
Set LotusItem = LotusDoc.CREATERICHTEXTITEM("Attachment")
Set AttachedFile = LotusItem.EMBEDOBJECT(1454, "", strFile)
With LotusDoc
.Subject = strSubject
.Body = strBody
.SendTo = strAddress
.CopyTo = strCopyTo
.SAVEMESSAGEONSEND = True
.Send False
End With
ExitHere:
Set LotusSes = Nothing
Set LotusDbs = Nothing
Set LotusDoc = Nothing
Exit Sub
Err_EMailUsingLotusNotes:
MsgBox "Error: Email was not sent to " & strAddress, _
vbOKOnly, "Error Sending Email!"
Resume ExitHere
End Sub
Sub EMailUsingLotusNotes(strSubject As String, strFile As String, _
strAddress As String, Optional strCopyTo As String, Optional strBody As String)
On Error GoTo Err_EMailUsingLotusNotes
' Sends simple email using Lotus Notes
' Does NOT Require Reference to Lotus Notes Object Library
' does not save to users sent box
Dim LotusSes As Object ' Lotus Notes Session
Dim LotusDbs As Object ' Lotus Notes Database
Dim LotusDoc As Object ' Lotus Notes Document
Dim LotusItem As Object ' Lotus Notes RichTextFile
Dim AttachedFile As Object ' Attachment
Set LotusSes = CreateObject("Notes.NotesSession")
Set LotusDbs = LotusSes.GETDATABASE("", "")
LotusDbs.OPENMAIL
Set LotusDoc = LotusDbs.CREATEDOCUMENT()
Set LotusItem = LotusDoc.CREATERICHTEXTITEM("Attachment")
Set AttachedFile = LotusItem.EMBEDOBJECT(1454, "", strFile)
With LotusDoc
.Subject = strSubject
.Body = strBody
.SendTo = strAddress
.CopyTo = strCopyTo
.SAVEMESSAGEONSEND = True
.Send False
End With
ExitHere:
Set LotusSes = Nothing
Set LotusDbs = Nothing
Set LotusDoc = Nothing
Exit Sub
Err_EMailUsingLotusNotes:
MsgBox "Error: Email was not sent to " & strAddress, _
vbOKOnly, "Error Sending Email!"
Resume ExitHere
End Sub