Help - Agent - LotusScript to send mail from Server
Rubens Sayegh 10/19/2007 02:24 PM
Domino Designer All Releases Windows XP
I have the following scenario:
An application (located at the server) that runs an agent at a pre-determined time, in which it selects a certain condition and sends a mail message to a group of users.
The condition to generate the message is OK.
The recipient´s list is obtained from a hidden view and their names are being stored in an array with the instruction:
Dim RecNames (1 to 1000).
Here´s the first doubt: I wouldn't like to use an array for this. I don´t know how many names I would get. It could be 100 or 1200. With the "Dim", I had fixed this number in 1000.
What I really want is to populate a mail field with "n" names.
If I just simply add these names to a string variable, separated by commas or semicolons, there´s a problem when this string is interpreted in the mail form, specifically when the addresses have the @ sign. It gets all mixed up and the server generates an error message ("Could not send mail. Recipient not found.")
Then there´s another problem: The application is not a "mail" application. The question is: Do I have to specifically inform the server to use a "mail form"? Or just by the fact that I mention in the agent "doc.BlindCopyTo = RecNames" it will produce a mail document?
Here´s the code:
... all definitions and declarations...
... routine to generate the message contents... (in “MessageContents” variable)
... Now to the mail problem section...
... Here I already have the message contents and am preparing to capture the recipient´s name list.
Dim doc As NotesDocument
Set doc = New NotesDocument(db)
doc.Subject = "This is the message's subject”
doc.Body = MessageContents
Xporte="" ' This variable was defined at the beggining
Set view = db.GetView( "RECIPNAMES" )
Set nav = view.CreateViewNav
Set entry = nav.GetFirst
Dim i As Integer
i = 1
Dim RecNames (1 To 1000)
While Not ( entry Is Nothing )
Xporte = entry.ColumnValues(0)
If Xporte<>"" Then
RecNames(i) = entry.ColumnValues(2)
Xporte = entry.ColumnValues(3)
i = i+1
Set entry = nav.GetNext( entry )
doc.BlindCopyTo = RecNames
Any help would be very appreciated.
Thanks in advance and best regards,