Before Mail arrives & Prompt to user


Does anyone know why this is not possible ?.  For some reason this is not working as I thought it would.

The coal : Prompt user if the Email address he/she  puts in his/her  calendar profile is True

runs on : Before Mail arrives

CODE:

Sub Initialize
Dim Session As NotesSession
Dim DB As NotesDatabase
Dim doc As NotesDocument
Dim docProfile As NotesDocument
Dim strAction As String
Dim strFolder As String
Set Session = New NotesSession
Set doc = Session.DocumentContext
Dim ErrorHandler As Variant

‘If doc.HasItem(“SMTPOriginator”) Then
Set DB = Session.CurrentDatabase

Set docProfile = db.GetProfileDocument(“CalendarProfile”)
strAction = UCase(docProfile.EmailToCheck(0))
If Not docProfile Is Nothing Then
If Not Isname(db, doc, docProfile,strAction) Then
End If
End If

End Sub

Function IsName(DB As NotesDatabase, Doc As NotesDocument, docProfile As NotesDocument,strAction As string) As Integer

Isname = False

Dim docWhiteList As NotesDocument
Dim strFrom As String
Dim strTemp As String
Dim ws As New NotesUIWorkspace
On Error GoTo ErrorHandler
If doc.From(0) <> “” Then
strFrom = UCase(doc.From(0))
Print strFrom
Else
Exit Function
End If

If strFrom = “” Then
If doc.From(0) <> “” Then
strFrom = UCase(doc.From(0))
Print strFrom
Else
Exit Function
End If
End If

If strAction <> strFrom Then
GoTo bailout
End If

Dim workspace As New NotesUIWorkspace
Call workspace.DialogBox( “GotEmail”, True, True, True, True,    False, False, “Email you need to read”,”” )
‘ OR this us this

‘Call ws.Prompt(PROMPT_YESNO,”Urgent email”, “Email you need to read.”)

ErrorHandler:
Print CStr(Err) + ” – ” + Error + ” – ” + CStr(Erl)

bailout:

End Function

Advertisements

2 thoughts on “Before Mail arrives & Prompt to user

  1. Hi Palmi –

    If you are running an agent on the server with the trigger “before new mail arrives” that agent is only able to act on documents using backend classes. There is no connection between the user’s UI and the agent.

  2. Thought so , Thanks mike, shame that i can´t use the same function as Cleint has for ” you got mail “.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s