Found a Lotus script but don't know what it does

In a mailtemplate I found a Lotus script but I don't know what is that for.
(makes the bcc field empty when the mail creator isn't equal with the notes sesion username?)

Sub Initialize
      Dim ss As New notessession
      Dim db As notesdatabase
      Dim doc As notesdocument
      Dim useris$
      Set doc=ss.DocumentContext
      If doc.creator(0)<>ss.username Then
      End If      
End Sub
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
Strange code...

To begin with, it is in an Initialize. Where does this come from? A Script library? An agent? A form?

Referring to DocumentContext is always related to agents, and mostly to Web-agents. From Notes, its value may be Nothing.

So I assume this is a web-agent. Where is it called from, WebQueryOpen or WebQuerySave? In either case, the doc.Save is BAD coding.

Please some more info before I'm completely on the wrong track...
attila01Author Commented:
You're right, this is an Initialize and it comes from an agent.

This Agent is in a mailtemplate. Every user (in our company) has this agent among others in his mailbox.
The name of the agent is "delbcc" which could indicates that this has something to do with an action like delete the bcc field?

We don't have web access to Lotus Notes.

attila01Author Commented:
Trigger of the agent = Before mail arrives
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Sjef BosmanGroupware ConsultantCommented:
AFAIK, that agent isn't in the standard template. Who created the agent? NewBCC must also be some addition to the template. Maybe the idea was to prevent mails to be sent or forwarded by secretaries... I don't know.

Lots of guesswork here. Interesting puzzle, something for Marilyn... ;)
I saw this type of agent in 4.6, when people wanted to delete the group mail names so people wouldn't know the bulk group names in order to send to everyone.   Notes teams added this to remove the contents of the BCC field for a couple of reasons.. to prevent SPAM - server tries forever trying to route the rest of the BCC list.  This would clear the list before mail arrives.. or in

But, the documentcontext is a new method with r6, isn't it?  The odd thing is that there seems to be a new field added called newbcc, wonder what that is used for?  And before they delete it the contents, wonder what it has in it?

My guess is that there is another agent that uses the field newbcc.   and it would be interesting to see where it is called, and if it even works.

Try NotesPeek on the mail template to see who wrote it and when it was added.   You can also identify other parts of the mail template that might be affected.

In the meantime, I would suggest grabbing nice new vanilla mail templates from a temporary local server install (if you don't have them sitting on your server), and compare the two to see what you do and don't need.   Or maybe you don't need any of the "add ons"
attila01Author Commented:
You mean if somebody enter a group name in the bcc field this agent would break up the group names? The group member's name would be displayed but not the group name?
attila01Author Commented:
I checked the agent list's last modified column and saw that all agent was modified by me or the Lotus Notes Template Development, except 2 agents.

The above I've already pasted and the one below.
This two was modified by another mailserver (administrated by the lotus administrator in the central of the company)

This second agent's name is: (SendBCC) see the contents in my next comment:
I replaced the company name with xxx

attila01Author Commented:
Sub Initialize
      Dim session As New NotesSession
      Dim ws As New notesuiworkspace
      Dim db As Notesdatabase
      Dim bccdoc As NotesDocument
      Dim rtitem As NotesRichTextItem      
      Dim uidoc As notesuidocument
      Dim createDate
      Dim ddate As NotesDateTime
      Set db = session.CurrentDatabase
      Set uidoc=ws.currentdocument
      Set bccdoc=uidoc.document
      bccdoc.Form = "Memo"
      Set ddate = New NotesDateTime( Cstr(bccdoc.created) )
      createDate = Right$(Cstr(ddate.dateonly),2)
      If bccdoc.EnterBlindCopyTO(0)="" Then
            Select Case createDate
            Case "01":      bccdoc.EnterBlindCopyTO="CN=xxx1/OU=xxx/OU=xxx/O=Company"
            Case "02":      bccdoc.EnterBlindCopyTO="CN=xxx2/OU=xxx/OU=xxx/O=Company"
            Case "03":      bccdoc.EnterBlindCopyTO="CN=xxx3/OU=xxx/OU=xxx/O=Company"
            Case "31":      bccdoc.EnterBlindCopyTO="CN=M31/OU=KHH/OU=PHYCOMP/O=YAGEO"            
            End Select
            Select Case createDate
            Case "01":      bccdoc.EnterBlindCopyTO=Arrayappend(bccdoc.EnterBlindCopyTO,"CN=xxx1/OU=xxx/OU=xxx/O=Company")
            Case "02":      bccdoc.EnterBlindCopyTO=Arrayappend(bccdoc.EnterBlindCopyTO,"CN=xxx2/OU=xxx/OU=xxx/O=Company")                             Case "03":bccdoc.EnterBlindCopyTO=Arrayappend(bccdoc.EnterBlindCopyTO,"CN=xxx3/OU=xxx/OU=xxx/O=Company")

            Case "31":      bccdoc.EnterBlindCopyTO=Arrayappend(bccdoc.EnterBlindCopyTO,"CN=xxx31/OU=xxx/OU=xxx/O=Company")            
            End Select      
      End If
      If bccdoc.sendto(0)="" Then
            Dim msg
            msg = ws.Prompt(PROMPT_OK, "Lotus Notes", "No names found to send mail to ", "", "")
      End If
      Call bccdoc.Send( False )
      'Call uidoc.close
End Sub
Sjef BosmanGroupware ConsultantCommented:
In 4.6?? I seem to remember that in 4.6 the trigger "Before mail arrives" didn't exist. But that was ages ago...

It seems like some "primitive" form of Message Tracking device, with 31 mail-in databases or so. When or how is the agent triggered? Is it a replacement for the Send-button?
attila01Author Commented:
We're using R6.5 with two different mailtemplate but both of the mailtemplates has the above agents.

The first agent's properties:
Trigger: on event, before new mail arrives
Target: each incoming mail document

The second agent' properties:
Trigger: on event, agent list selection
Target: none

attila01Author Commented:
As far as I know a copy from every mail will be sent to a mailbox for archiving purposes.
That means, when a user click the send button a copy is sent automatically to a mailbox mentioned in the second agent:


Sometimes ( I guess, when something went wrong with the agent ) we saw in the bcc field an address we didn't entered.

So the mailtransfer is doubled within the company.
Sjef BosmanGroupware ConsultantCommented:
I assume these agents are home-made, and that the second agent is activated from the Send-button in the Memo-form. If you want to make sure, then download DDSearch from the Sandbox ( and search the template (NOT the mail database!!) for all occurrences of the name of the 2nd agent.

It is FAR better to set up Message Tracking, see the Admin Help database on that subject. You can specify what is to be stored in the Message Tracking database from the server's Configuration document in the NAB: Router/SMTP tab, Message Tracking.
You know, I've seen something like this also, for archiving... the new SEC requirements say something like you have to save all transactions and such, so before message tracking, this was one way of sending the requisite copy to another application.  PRovided that the BCC's in the second agent were some type of group emails on another server.

Now, if you set up message tracking, then anything sent to the "archive" databases, might be encrypted, so who ever did this, did it this way to make sure that the deposited items could be read?

That's my guess.   I'm also going to guess that the select cases all correspond to users who have month days in their names, and each of those databases have other agents that roll the days into months, and those into years.. or possibly they're just archiving the month.

Clever actually, but they should have documented in the code, else someone without knowledge might go and delete the "month" users.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
attila01Author Commented:
I downloaded and installed the DDSearch program sjef mentioned but got the error message  --Creation of Outline instance failed--
and the Search option under Tools in the Designer didn't appear.
This is the whole error message:

Error Report generated at 2006.04.12. 8:21:26

Program name:      DDSearch
Release:      2.1.0
Install path:      C:\Program Files\DDSearch
MultiInstance:      False
Process ID:      4194304
Thread ID:      2360
DLL error:      0
Module name:      cApplication::Install
Error number:      7436
Error message:
Creation of Outline instance failed

Module hints:

NotesSession: GetSession->OK
NotesSession: GetBuild->194
attila01Author Commented:
>>so who ever did this, did it this way to make sure that the deposited items could be read?
You're totally right.

>>the select cases all correspond to users who have month days in their names
You're right again. the mailbox names are:
- M01/CompanyNames
- M02/CompanyNames
- M31/CompanyNames

>>so before message tracking, this was one way of sending the requisite copy
You mean in the Administrator there is a way to send a copy from all the mails into a mailboy for archiving purposes?

Sjef BosmanGroupware ConsultantCommented:
Yes, Message Tracking!!

> It is FAR better to set up Message Tracking, see the Admin Help database
> on that subject. You can specify what is to be stored in the Message Tracking
> database from the server's Configuration document in the NAB: Router/SMTP
> tab, Message Tracking.

That's what I wrote yesterday. It's there, you just have to switch it on...

And about SDDSearch: I did have some problems installing it, but if you do it exactly as they say it's usually easy. So, please, try to install again.

If you already have TeamStudio, you don't have to install DDSearch, TeamStudio can do the same and much more! Read also the attached response documents in the Sandbox where you downloaded DDSearch, or add one yourself if re-installing isn't successful.
attila01Author Commented:
Yes, I use the Message Tracking option, but there you can only see to whom the user sent mails and with which subject but it don't store the mails physically.

Sjef BosmanGroupware ConsultantCommented:
Sorry, see Mail Journaling, also in the Configuration document: Router/SMTP, Advanced, Journaling.
My bad, too.. I mean message Journaling, which would not have been available in R5, but is now, I think.. could be wrong.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.