"After new mail has arrived" agent

Hi allI have created an agent, which is supposed to run on event “After new mail has arrived”. However it never runs. When I change startup type to manual (from menu) it runs fine. I have Manager access to my own mailbox and no access to Domino server.

I’m not Domino specialist. Therefore may be I missed something important. Is there any prerequisites to create and use such type of agents (permissions, settings, etc)?

Thank you in advance

Subject: post your code

Subject: Code

Option PublicOption Declare

Sub Initialize()

dim session As NotesSession

Dim docs As NotesDocumentCollection

Dim doc As NotesDocument

Dim subject 

Set session = New NotesSession

Set docs = session.CurrentDatabase.UnprocessedDocuments

Set doc = docs.Getfirstdocument()

While Not(doc Is Nothing)

	subject = "(MODIFIED) " & doc.Subject(0)

    doc.Subject = subject

    doc.Save True, false, False

    Set doc = docs.Getnextdocument(doc)

wend

End Sub

Subject: Use DocumentContext

For an agent activated “Before New Mail Arrives,” the in-memory document is the email that is about to be delivered. Because the agent is activated instantly for each email as it’s about to be saved into the mail database, each time the agent runs you are working with a single unsaved document. The NotesDatabase.UnprocessedDocuments property will not return any documents for this agent type.