Hi,
I am trying to send an email to multiple people in a list I am building up in an XPage :
Here is the JS that builds up the email recipients :
FLSCall.setValue(“NameList”,FLSCall.getItemValueString(“NameList”) + “;” + sessionScope.UName);
I call a LotusScript agent when the document saves to send an email to the users. Here is the Function that does that :
Sub UserEmail(WebDoc)
'declare variables
Dim s As New NotesSession
Dim db As NotesDatabase
Dim rtitem As NotesRichTextItem
Dim strSendTo() As String
Dim maildoc As NotesDocument
Dim strMailBlurb As String
Dim item As NotesItem
Dim ItemSendTo As NotesItem
'Set the variables
Set db = s.CurrentDatabase
Set maildoc = New NotesDocument(db)
maildoc.Form = "Memo"
Set rtitem = New NotesRichTextItem(maildoc, "Body")
strMailBlurb = "Hi," & Chr(13) & Chr(13) &"Thank you for contacting Clyde Union I.T. Service Desk. Your request has been received by our team and you" & _
" will be contacted within 2 working hours." & Chr(13) & Chr(13) & "Yours sincerely," & Chr(13) & Chr(13) & "Clyde Union I.T. Service Desk."
'Prepare subject and body text
maildoc.subject = "Your I.T. Service Desk Call #" & WebDoc.SDNum(0) &"."
Set item = WebDoc.GetFirstItem("EmailList")
MsgBox "Emails To : " & item.Values
'Attach Link
'strMailBlurb = strMailBlurb & Chr(13) & Chr(13) & "http://support.clydeunion.com/GLAAPP/itsd.nsf/en_SupportCall.xsp?documentId=" & WebDoc.Universalid & "&action=openDocument"
'maildoc.SendTo = "Jamie Grant/GB/CPL/ClydePumpsLtd"
Call rtitem.AppendText(strMailBlurb)
Call rtitem.AppendText(Chr(13) & Chr(13))
'Send Mail - Only if the description and Blurb has been filled.
If strMailBlurb = "" Then
Exit Sub
Else
If WebDoc.EmailCaller(0) = "Yes" And WebDoc.EmailList(0) <> "" Then
Call mailDoc.Send(False, item.Values)
End If
End If
End Sub
The email is sending but only to the first person in the list. I previewed the EmailList field in the XPage and all the values are separated by a ; and in the Notes Form, multivalue is enabled with ; set as both the separator and the display.
I have also tried the CopyItem when sending the mail and it didnt work.
Any help appreciated.
Thanks
Jamie