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!

Using Lotus Notes to Send Email

Status
Not open for further replies.

jdwm2310

Technical User
Jul 26, 2001
396
US
Please Help!!!! I am using Lotus Notes to send email from Access 97, but I am getting compile errors: type declaration does not match declared type...this is driving me crazy: this is the module that I am using:

[tt]Public Sub SendNotesMail(Subject As String, Attachment As String, Recipient As String, cc As String, BodyText As String, SaveIt As Boolean)

'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 NotesDocument
Dim MailDoc2 As Object
Dim AttachMe As Object 'The attachment richtextfile object
Dim session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object Attachment
Dim CurrentDatabase As String
Dim NotesSS As New NotesSession
Dim NotesDb As New NotesDatabase
Dim SendFolder As String
Dim view As NotesView


On Error GoTo Errshow:


NotesSS.Initialize '"password" ' you can place your password here to go straight in if not logged in already

With NotesSS
Set NotesDb = .GetDatabase("Mail3/SIAC", "mail/jperez.nsf", False)
End With

With NotesDb
'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 = NotesDb
Set MailDb = session.GetDatabase("", MailDbName)

If Not (MailDb.IsOpen) = True Then MailDb.OPENMAIL

'Set up the new mail document
Set MailDoc = MailDb.CreateDocument
With MailDoc
.Form = "Memo"
.sendto = Recipient
.CopyTo = cc
.Subject = Subject
.Body = BodyText
.SaveMessageOnSend = SaveIt
.principal = "user account" '(if different to your default account name)
'.PutInFolder SendFolder, True '(if you need a copy in the sent folder)
End With

'Set up the embedded object and attachment and attach it
If Attachment <> &quot;&quot; Then
Set AttachMe = MailDoc.CreateRichTextItem(&quot;Attachment&quot;)
Set EmbedObj = AttachMe.EmbedObject(1454, &quot;&quot;, Attachment, &quot;Attachment&quot;)
MailDoc.CreateRichTextItem (&quot;Attachment&quot;)
End If
End With

'MailDoc.PutInFolder (SendFolder)

'Send the document
MailDoc.Send 1, Recipient


MsgBox &quot;Sent!&quot;, vbExclamation

Cleanup:

Set MailDb = Nothing
Set MailDoc = Nothing
Set AttachMe = Nothing
Set session = Nothing
Set EmbedObj = Nothing

Exit Sub

Errshow:
MsgBox (Err.Description)
GoTo Cleanup

End Sub[/tt]

Hopefully someone can shed some light..Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top