Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Set rules for incoming mail and resend a notification using lotusscript

Posted on 2003-10-25
12
Medium Priority
?
905 Views
Last Modified: 2013-12-18
HI all,
  I am trying to replicate the existing Email rules... agent to suit my needs. I am trying to call a registration window using a C API when an mail arrives with a particular subject. Existing rules settings doesnt provide me that kind of solution. I have gone through the complete source code.
I have found that it contructs a simple formula stores it in a formula field to perform the action, I want to use lotusscript in the same place.I also say agentlog.logaction("is a new note") what does that mean...
So I would like to know the complete working of hidden agents, like when and how they are triggered... what is the exact background process that is happening. This is quite urgent. If someone could help me I will be very thank full. I tried to search about agents in and out on the net but everything just explains the basics and some server issues. This agent still lies a mystery to me.

Please help,
Thanks in advance
0
Comment
Question by:ultimatewinner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 31

Expert Comment

by:qwaletee
ID: 9621539
I think you are best off just writing a "before new mail is delivered" agent.

The existing rules do not run via an agent.  The router runs them (off the CalendarProfile profile document) as it delivers the messages.

If you want to do something similar, you will have to use the extension manager to hook any database write calls, see if they are coming from the router, and running your rules.  Mightbe easier to just check if the destination DB is in the mail OS disk directory.

As far as a construct for storing the LotusScript, let me suggest the following.  I believe that using the API you can call an agent, and provide it either DocumentContext or UnprocessedDocuments.  So, set it up that way, hand it unprocessed documents, and it will run as you wish.

At this point, you've essentially duplicated teh functionality of "before new mail is delivered," as I mentioned.

Ah, but you want to make it configurable for users?  That is still possible.  The Execute statement in LotusScript will execute arbitrary code form a string.  It has access to global vaiables, so set up UnprocessdDocuments as a global, or, loop through the docs yourself, and set a global doc variable before calling each bit of LotusScript in turn.
0
 
LVL 4

Expert Comment

by:lotusnotesnewbie
ID: 9639976
HI ,
First I tried thought of writing after new mail arrives agent... But since it is new with release 5 I dropped that idea. I wanted it to be compatible both for versions 4 and 5. Now I have changed my mind. I want it to work atleast for one version. I am going ahead with it... I dont know I am stuck up in one place where I process multiple conditions. Where do I get this conditions from. LIke from the rule processed... How do I select the conditions...
This is a little immediate requirement. Some one please help
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 500 total points
ID: 9648742
Here is a little example

(Declarations)
Dim actionToTake as string 'MOVE folder-name or COPY folder-name.  Delte would be via MOVE (%Trash)
Dim docToProcess as notesDocument
Dim ruleList() As String

Sub SetUpRules
  Redim ruleList(2)
  ruleList(0) = |
    If instr(lcase(docToProcess.getItemValue("Subject")(0)),"SPAM") <> 0 Then
       actionToTake = "MOVE ($Trash)"
    End If
|
  ruleList(1) = |
    If instr(lcase(docToProcess.getItemValue("From")(0)),"the_boss") <> 0 Then
       actionToTake = "COPY Folder-for-boss-eMail"
    End If
|
  ruleList(2) = |
    If instr(lcase(docToProcess.getItemValue("From")(0)),"mail_list") <> 0 Then
       actionToTake = "MOVE Hold-for-later"
    End If
End Id
|
Sub Initalize
  Dim s as new notesSession
  DIm db as notesDatabase
  Set db = s.currentDatabase
  Dim docs as notesDocumentCollection
  Set docs = db.unprocessedDocuments
  Dim docToProcess as notesDocment
  Set docToProcess = docs.getFirstDocument(doc)
  DO Until Doc Is Nothing
    ForAll rule in ruleList
      Execute rule
      If actionToTake <> "" Then
        documentToProcess.putInFolder Mid$(actionToTake,5)
        If left(actionToTake,4) = "MOVE" Then
          documentToProcess.RemoveFromFolder "($Inbox)"
        End If
      End If
    End FOrall
    set docToProcess = docs.getNextDocument(docToProcess)
    If
  Loop
End Sub

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:ultimatewinner
ID: 9652003
I would say from my heart that was one excellent piece of code. I am working on it. I will get back as soon as I finish my complete code...
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9657773
There are a couple of bugs in it, go find 'em!

:)
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9657783
By the way... is ultimatewinner the same as lotusnotesnewbie?
0
 

Author Comment

by:ultimatewinner
ID: 9659116
Ya I did find them one was a spelling mistake, in notesdocment and the other was getfirstdocument(doc) :-))
0
 

Author Comment

by:ultimatewinner
ID: 9659173
Both of us belong to the same team struggling with a similar kind of problems as both of us are brand new to lotus notes and dealing with something quite big :-)) .Does that clarify you doubt.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9659174
Well, those are syntac errors, not bugs.  Look for the bugs.  Let me know if the code works.

Hints: Don't let your kids set off fireworks, it is dangerous, and can do things like displacing limbs.  If they ignore the rule, don't let anger get the upper hand; your kids have a lower sense of proportion, and you have to accomodate that.
0
 

Author Comment

by:ultimatewinner
ID: 9659253
What was that hint for... Ok I know Lotus Notes is highly sensitive and I wont be pressurising it too much, I have experienced too much of crashes already. I know I have every reason to compromise with LotusNotes
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9659270
Hint was to help find bugs.

Never mind, the bugs are really minor, and will not affect the basic way the system works.
0
 

Author Comment

by:ultimatewinner
ID: 9830754
Thank you so much qwaletee. My rules are doing just good. Still I am doing unit testing on it. But I have come this far just with the start up that you gave. I have literally fought over it and have come this far.
My rules work great even with multiple conditions.
But as you mentioned before what are those small bugs... I am not sure whether I have resolved those. If you could tell me I will reconfirm so that I will be even more confident.

Thank you so much
Cheers,
ultimatewinner :-)
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

647 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question