How do you Email with Web-based Lotus Notes

Sprocket

Registered User.
Local time
Today, 21:20
Joined
Mar 15, 2002
Messages
70
Hi Folks,

I know emailing from Lotus Notes has had quite a few airings but this is a new twist.

I have been sending emails with SNP attachments for a couple of years without any problems.

However, our IT people has seen fit to change/upgrade our mailboxes to version 6.5 so that staff who hot desk throughout the day can now pick up email from a web-based version of Lotus Notes rather than logging into a local client as before.

My problem is that the code I have used so far does not work with the web- based version. Does anyone Know how to open a Notes session with the web-based verion of Lotus Notes?

Below is the code I use at present.

Private Sub Send_as_email_Click()

On Error GoTo ErrorHandler
Dim stDocName As String
Dim stFileName As String
Dim P1 As String
Dim P2 As String
Dim P3 As String
Dim ShortName
Dim myFileName
Dim myPath
Dim Emailto As String

Me.Refresh

myPath = Me.FAC_INITIAL
P1 = Me.FIRST_NAME
P2 = Me.LAST_NAME
P3 = ".snp"
myName = P1 & " " & P2
myFileName = P1 & " " & P2 & P3
If IsNull(Me.TUTOR_TEXT1) Then
MsgBox "No information entered in the main text field"
Exit Sub
End If

If IsNull(Me.REPORT_DATE) Then

MsgBox "you have not entered a report date"
Forms!special_needs!REPORT_DATE.SetFocus
Exit Sub
End If

If IsNull(Me.DYSLEXIA_TUTOR_ID) Then
MsgBox "you have not entered a Tutor name"
Forms!special_needs!DYSLEXIA_TUTOR_ID.SetFocus
Exit Sub
End If



stDocName = "EmailFacultyForm"

DoCmd.OutputTo acOutputReport, stDocName, acFormatSNP, "s:\cross-faculty\study assistance\EmailForms\" & myPath & "\" & myFileName



'Sub SendNotesMail(Subject as string, attachment as string,
'recipient as string, bodytext as string,saveit as Boolean)
'This public sub will send a mail and attachment if neccessary to the
'recipient including the body text.
'Requires that notes client is installed on the system.
'Public Sub SendNotesMail(Subject As String, Attachment As String, Recipient 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
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim Subject As String
Dim Attachment As String
Dim BodyText As String
Dim SaveIt As Boolean
Dim Recipient(3) As Variant
Dim CopiedTo(3) As Variant
Dim Sendto As Variant

'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Next line only works with 5.x and above. Replace password with your password
'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 or using above password you can use other mailboxes.
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes


If IsNull(Me.FAC_EMAIL_2) Then

Recipient(0) = Me.FAC_EMAIL
CopiedTo(0) = Me.SSN_EMAIL


Else
Recipient(0) = Me.FAC_EMAIL
Recipient(1) = Me.FAC_EMAIL_2
CopiedTo(0) = Me.SSN_EMAIL
End If



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
Subject = "Disability support request for: " & myName
Attachment = "S:\Cross-faculty\Study Assistance\EmailForms\" & myPath & "\" & myFileName



BodyText = "Request for disability support."

SaveIt = True


Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.Sendto = Recipient(0) 'is an array using "recipient(index number)" starts at zero
MailDoc.copyto = CopiedTo 'is an array using "CopiedTo(index number)" starts at zero
MailDoc.Subject = Subject
MailDoc.Body = BodyText
MailDoc.SAVEMESSAGEONSEND = SaveIt

'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")

End If
'Send the document
MailDoc.PostedDate = Now()
'Gets the mail to appear in the sent items folder
MailDoc.Send 0, Recipient
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing

Continuation:
Me.FacForm_Emailed.Value = Now()

Exit_Send_as_email_Click:
Exit Sub


ErrorHandler:
If Err.Number = 0 Or Err.Number = 20 Then
Err.Clear ' Clear Err object fields
GoTo Continuation:

ElseIf Err.Number = 7000 Then
' Lotus notes not configured properly
' Tell user what happened. Then clear the Err object.
Msg = "Lotus Notes is NOT configured properly for the current user!" & vbCrLf & vbCrLf & "Automatic email has NOT been sent. Please open Lotus Notes and try again."
MsgBox Msg, , "Email error"

Err.Clear
Me.FacForm_Emailed.Value = ""
Exit Sub
Else
[ Handle other situations here...
' Display error information
MsgBox "Error number " & Err.Number & ": " & Err.Description & vbCrLf & vbCrLf & "Automatic email has NOT been sent. Please try again." & vbCrLf & vbCrLf & "If problem persists report error to database administrator", , "Email error"
' Resume with statement following occurrence of error.

Err.Clear
Me.FacForm_Emailed.Value = ""
Exit Sub

End If


End Sub
 

Users who are viewing this thread

Back
Top Bottom