Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public strAttachement As Boolean
Public Function SendNotesMail(Subject As String, Attachment As String, recipient As String, BodyText As String, SaveIt As Boolean, RtnRec As String)
On Error GoTo EmailError:
'Set up the objects required for Automation into lotus notes
Dim mailDb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'The current users notes mail database name
Dim mailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string
'UserName = Session.UserName
'MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set mailDb = Session.GetDatabase("", MailDbName)
If mailDb.ISOPEN = True Then
'Already open for mail
Else
mailDb.OpenMail
End If
'Set up the new mail document
Set mailDoc = mailDb.CreateDocument
With mailDoc
'.Form = "Memo"
.SendTo = recipient
.Subject = Subject
.Body = BodyText
.SAVEMESSAGEONSEND = SaveIt
.PostedDate = Now() 'Gets the mail to appear in the sent items folder
.ReturnReceipt = RtnRec 'sets the return receipt on or off (0 or 1) value 0 is off.
End With
'Set up the embedded object and attachment and attach it
If strAttachement = True Then
Set AttachME = mailDoc.CreateRichTextItem(Attachment)
Set EmbedObj = AttachME.EmbedObject(1454, "", Attachment, "Attachment")
mailDoc.CreateRichTextItem ("Attachment")
End If
'Send the document
mailDoc.Send 0, recipient
'Clean Up
Set mailDb = Nothing
Set mailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
Exit Function
EmailError:
Select Case Err
Case 7294
MsgBox "The recipient cannot be found in the Address book. Please verify against Lotus Notes database and update your mail records.", 64 + 0, "E-Mail Address Not Found"
Case Else
MsgBox Err.Number & " - " & Err.Description
End Select
End Function