Hello everyone,
Please can somebody tell me why Im getting this error message?
- No names found to send mail to.
Here is the lotusscript i am using to send mail to users
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set db = session.CurrentDatabase
Set uidoc = ws.CurrentDocument
Dim bodyRTF As NotesRichTextItem
Dim emailMsg As New notesdocument(session.CurrentDatabase)
Set emailMsg = New NotesDocument(session.CurrentDatabase)
emailmsg.sendTo = uidoc.FieldGetText("SWUser")
emailmsg.subject = "FYI: Order Notification"
Set bodyRTF = emailMsg.CreateRichTextItem("Body")
Call bodyRTF.AddNewline(1)
Call bodyRTF.AppendText("Hi,")
Call bodyRTF.AddNewline(2)
Call bodyRTF.AppendText("Your order enquiry has been submitted.")
Call bodyRTF.AddNewline(2)
Call bodyRTF.AppendText("This will be looked into within the next 24hrs")
Call bodyRTF.AddNewline(2)
Call bodyRTF.AppendDocLink(uidoc.Document, "Please follow the link to view your order that you submitted")
Call uidoc.save
Call emailMsg.Send(False)
End Sub
Thank you
Subject: No names found to send mail
Just some thoughts - I usually set the ‘Form’ to ‘Memo’ but I’m not sure if this is actually required - could check that.
What value does the SWUser field have in it when you debug? I have a problem in the past using a group with only my name in it when working locally.
Jayne
Subject: RE: No names found to send mail
Hi Jayne
Well it should be displaying something like username/group/company
e.g. Stabilio Genuis/Sup/ITTechs
but it is displaying nothing? The results should be pulled from another field on another form in the same DB but doesnt appear to be doing this. In the properties I have selected computed and entered the field name from the other form.
I have also tried the memo idea too - but still no change
Any other suggestions??
Thanking you in advance
Subject: RE: No names found to send mail
Clearly SWUser is blank.
I would suggest you add to your code:
if Trim(uidoc.FieldGetText(“SWUser”)) <> “” then
emailmsg.sendTo = uidoc.FieldGetText("SWUser")
emailmsg.subject = "FYI: Order Notification"
Set bodyRTF = emailMsg.CreateRichTextItem("Body")
Call bodyRTF.AddNewline(1)
Call bodyRTF.AppendText("Hi,")
Call bodyRTF.AddNewline(2)
Call bodyRTF.AppendText("Your order enquiry has been submitted.")
Call bodyRTF.AddNewline(2)
Call bodyRTF.AppendText("This will be looked into within the next 24hrs")
Call bodyRTF.AddNewline(2)
Call bodyRTF.AppendDocLink(uidoc.Document, "Please follow the link to view your order that you submitted")
Call uidoc.save
Call emailMsg.Send(False)
Else
MsgBox("SWUser is blank cannot send mail.")
End if