Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lotus Notes Problem

Status
Not open for further replies.

smdemo

Programmer
Sep 15, 2002
63
US
I currently have emails being sent out of Lotus Notes with my code below. Now I have a new project where I will need emails sent from a group mailbox in Lotus Notes and not the user's personal Lotus Notes email. Does anyone have any idea how I can do that with the code below?


Module Code:

Public Function SendMail(strTo As String, strSubject As String, strMessage As String, _
strCC As String, strBCC As String, Attachment As Boolean, strAttachLocate) As Boolean
Dim NotesSession As Object, NotesDatabase As Object, NotesDocument As Object
Dim NotesAttach As Object, strServer As String, strFileName As String
On Error GoTo NotesUnavail
Set NotesSession = CreateObject("Notes.NotesSession")
Set NotesDatabase = NotesSession.GetDatabase("", "")
NotesDatabase.OPENMAIL
strServer = NotesDatabase.Server
strFileName = NotesDatabase.FilePath
Set NotesDatabase = Nothing
Set NotesSession = Nothing
Set NotesSession = CreateObject("Notes.NotesUIWorkspace")
Set NotesDocument = NotesSession.COMPOSEDOCUMENT(strServer, strFileName, "Memo")
NotesDocument.InsertText strTo
NotesDocument.GOTONEXTFIELD
If strCC <> "" Then NotesDocument.InsertText strCC
NotesDocument.GOTONEXTFIELD
If strBCC <> "" Then NotesDocument.InsertText strBCC
NotesDocument.GOTOFIELD "Subject"
NotesDocument.InsertText strSubject
NotesDocument.GOTOFIELD "Body"
NotesDocument.InsertText strMessage & VBA.vbCrLf & VBA.vbCrLf & CloseMessage
If Attachment = True Then
'we need to include the attachment into the mail
Set NotesAttach = NotesDocument.Document.CreateRichTextItem("Attachment")
NotesAttach.EmbedObject 1454, "Document", strAttachLocate
End If
'to edit in notes remove the following 2 lines
NotesDocument.Send
NotesDocument.Close
On Error GoTo 0
SendMail = True

SendMail_Exit:
Set NotesAttach = Nothing
Set NotesDocument = Nothing
Set NotesDatabase = Nothing
Set NotesSession = Nothing
Exit Function

NotesUnavail:
SendMail = False
MsgBox "Your Lotus Notes email is not Open or The Server is currently unavailable. If your Lotus Notes Application is not open please start it now and try again. Your notification was not sent.", vbInformation
GoTo SendMail_Exit:
End Function



Button Code:

Dim stDocName As String

stDocName = "rpttest"

DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, "L:\Test.rtf", False

SendMail "test@test.com", "Test Message Using Access", "Please see attached.", "", "", True, "L:\Test.rtf"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top