Author
Sudhakar R. Kuman (sudkunam@in.ibm.com)
Scenario :
Customer daily needs to send the report to multiple groups (say 500+) with many
Users in each group. Whenever he tries to send mail to all the groups in one mail, he gets
64k-limit error. In this scenario, user needs to compose multiple mails and select fewer
groups every time. Composing multiple mails and selecting a small number of groups
is cumbersome.
Customizable Solution :
This can be done by creating a database to store the group documents for which the mail need
to be send and a lotus script agent to send the mail.
Procedure :
Create a database , design a Form to create group documents. (Each group to which the user is sending
Should have a document with the same group name) and a view to show the group documents.
Creating a database :
File Application New
Name it as ‘grpdb.nsf’
Creating a Form :
Open the database in Domino Designer Client.
Go to ‘Forms’ and Create Form
Name the form as ‘grpfrm’
Create Field
Name the field as ‘grpname’
Save the form.
Create a View to show all the group documents.
Go to Views and Create View
Name the View as ‘grpview’
Select form name as ‘grpfrm’
Create a column and name it as ‘Groupname’ and select field name as ‘grpname’
Save the view.
Open the database, create group documents as per the requirement.
(Note : Group name in the document must match the group name in your Domino Directory)
Create a Lotus Script agent in the mail template.
Set agent properties as shown below :
Paste the below code between Sub Initialize and End Sub
Dim session As New NotesSession
Dim db As NotesDatabase
Dim db2 As New NotesDatabase("ServerName","grpdb.nsf")
Dim view As NotesView
Dim grpdoc As NotesDocument
Set db = session.CurrentDatabase
Set view=db2.getview("grpview")
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument,
Dim doc2 As NotesDocument
Dim item As NotesItem
Dim collection As NotesDocumentCollection
Set collection=db.Unprocesseddocuments
Set doc = collection.Getfirstdocument()
Set doc2 = New NotesDocument(db)
doc2.Form="Memo"
Set item = doc.GetFirstItem("Subject")
Call item.CopyItemToDocument(doc2, "Subject")
Set item = doc.GetFirstItem("Body")
Call item.CopyItemToDocument(doc2, "Body")
Set grpdoc=view.getfirstdocument
While Not grpdoc Is Nothing
Call doc2.Send(False, grpdoc.grpname)
Set grpdoc=view.getnextdocument(grpdoc)
Wend
MessageBox "Done"
Agent Execution :
Open the Mail File and select the mail to be sent.
Go to Actions Click on the Agent name.