Link to home
Start Free TrialLog in
Avatar of kopibean
kopibean

asked on

How to send document in database to multiple persons listed?

I have a form and in this form, there is an editable Readers field - AuthorizedReader with default value - @UserName.
I created a button - MailSend so that when the author create this document, he/she will click on this button to send to all the person listed in the AuthorizedReader field.
My formula for the button works only when 1 username is in this field. If there are multiple users in this AuthorizedReader field, it give me this msg-> Document has been send to authorized readers! and follow by this error -> Unable to send mail, no match found in Name & Address Book(s). But the names listed are correct.

Formula for MailSend button:
Sub Click(Source As Button)
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Set uidoc=ws.CurrentDocument
      Call uidoc.save
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim newDoc As NotesDocument
      Dim curdoc As notesdocument
      Dim rtitem As NotesRichTextItem
      Dim dateTime As New NotesDateTime("")
      Set db = session.CurrentDatabase
      Set curdoc = uidoc.document
      Set newDoc = New NotesDocument( db )
      Set rtitem = New NotesRichTextItem( newDoc, "Body" )
      Call rtitem.AppendText( "New Meeting document added! Please follow this document link to view the meeting details" )
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendDocLink( curdoc, db.Title )
      Messagebox ("Document has been send to authorized readers!")
      Call uidoc.Close
      Call newdoc.Send(False,uidoc.FieldGetText("AuthorizedReader"))
      Call ws.ViewRefresh
End Sub

Pls help.
Thank you very much.

ASKER CERTIFIED SOLUTION
Avatar of madheeswar
madheeswar
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kopibean
kopibean

ASKER

The above works!!
I forgot I need to add in the subject ->
newdoc.Subject = "<From XXX DB>" + "[" + uidoc.FieldGetText("category") + "]" + uidoc.FieldGetText("subject")
Where do I place this code at?

Pls advise!
THanks!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Tom,
what you said is correct. I agree.
If the requirment is something like other perosns name should not be listed, then my approach is the only option. BCC is not an option.

I place the subject after this line ->

Call newdoc.Send(False,item.values(x))
newdoc.Subject = "<From " +  uidoc.document.parentdatabase.title + " DB>" + "[" + uidoc.document.category(0) + "]" + uidoc.document.subject(0)
Print "Mail Send to: "&Cstr(item.values(x))

but the subject in my inbox show nothing?
Did I place the subject code wrong?

Pls advise.
Thanks!


      
Opps...I know where to place the subject header....
thanks madheeswar and tom!!
then increase the points & Grade "A" and accept.

-Thanks
Why would bcc not be an option ?  It works great, the only thing you need to do is put a bogus /fake address in the sendto field  !

cheers,

Tom
TOM,
I want to display one name in To field and no names in other fields(CC/BCC).

So, then my approach is correct right. I had this requirement in my previous company.