VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Creating email and attaching a file in lotus notes

by Stan Allan (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (10 Votes)

This code is to show how to create an email in lotus notes with an attached file

Rate Creating email and attaching a file in lotus notes

Private Sub CmdSend_Click() 
Dim oSess As Object
Dim oDB As Object
Dim oDoc As Object
Dim oItem As Object
Dim direct As Object
Dim Var As Variant
Dim flag As Boolean
Form1.MousePointer = 11
Form1.StatusBar1.SimpleText = "Opening Lotus Notes..."
Set oSess = CreateObject("Notes.NotesSession")
Set oDB = oSess.GETDATABASE("", "")
Call oDB.OPENMAIL
flag = True
If Not (oDB.ISOPEN) Then flag = oDB.OPEN("", "")
If Not flag Then
MsgBox "Can't open mail file: " & oDB.SERVER & " " & oDB.FILEPATH
GoTo exit_SendAttachment
End If
On Error GoTo err_handler
Form1.StatusBar1.SimpleText = "Building Message"
Set oDoc = oDB.CREATEDOCUMENT
Set oItem = oDoc.CREATERICHTEXTITEM("BODY")
oDoc.Form = "Memo"
oDoc.subject = Form1.TxtSubject.Text
oDoc.sendto = Form1.TxtSendTo.Text
oDoc.body = Form1.TxtMessage.Text
oDoc.postdate = Date
Form1.StatusBar1.SimpleText = "Attaching Database " & Form1.TxtFilePath
Call oItem.EMBEDOBJECT(1454, "", Form1.TxtFilePath)
oDoc.visable = True
Form1.StatusBar1.SimpleText = "Sending Message"
oDoc.SEND False
exit_SendAttachment:
On Error Resume Next
Set oSess = Nothing
Set oDB = Nothing
Set oDoc = Nothing
Set oItem = Nothing
Form1.StatusBar1.SimpleText = "Done!"
Form1.MousePointer = 1
Exit Sub
err_handler:
If Err.Number = 7225 Then
MsgBox "File doesn't exist"
Else
MsgBox Err.Number & " " & Err.Description
End If
On Error GoTo exit_SendAttachment
Form1.MousePointer = 1
End Sub

Download this snippet    Add to My Saved Code

Creating email and attaching a file in lotus notes Comments

No comments have been posted about Creating email and attaching a file in lotus notes. Why not be the first to post a comment about Creating email and attaching a file in lotus notes.

Post your comment

Subject:
Message:
0/1000 characters