Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using a notes client(v 7.0). I created a mail account with email id xyz@abc.com in this client(obviously on domino server also). I want to auto reply to the mail which is sent to xyz@abc.com with same subject line which must be appended with ";SUCCESS" at the end of subject line.

share|improve this question

migrated from stackoverflow.com Apr 13 '10 at 2:40

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

Okay, you need a user agent and the privileges to create it locally, since you almost certainly won't be permitted to create it on the server copy of the mail DB (unless your Domino admins are a bunch of clowns). This will require Domino Designer to be installed on your client, not just Notes.

You then set up the agent to run on a schedule (say, 5 minutes). and then code up some LotusScript to process the relevant documents that have been added. I have never successfully got my scripts to run correctly on the "after new mail has arrived" event but you might have better luck :-).

The scripts I've done have all been simple enough to fit in the Initialize function. For example, the following will place all messages in the inbox that have "qwertyuiop" in the subject heading, into the junk folder.

Sub Initialize
    Dim s As New notessession
    Dim db As notesdatabase
    Dim view As NotesView
    Dim doc As NotesDocument

    Set db = s.CurrentDatabase
    Set view = db.GetView("($InBox)")
    If Not view Is Nothing Then
        Set doc = view.GetFirstDocument
        While Not doc Is Nothing
            If Instr(doc.GetFirstItem("subject").Text, "qwertyuiop")  Then
                Call doc.RemoveFromFolder( "($InBox)")
                Call doc.PutInFolder( "junk")
            End If
            Set doc = view.GetNextDocument(doc)
        Wend
    End If
End Sub

The fields you're interested in for your purposes are subject, inetfrom and inetsendto (at least in my mail DB). You can verify this by right-clicking one of the mails, selecting "Document properties" and selecting the second tab (the triangle) that list all the document fields.

Creating a response email should be a simple matter of creating a new document in the mail database and calling "newdoc.send(true,true)". I've never had to do this before but I whacked the following sample code together and it appears to work (but bug-fixing is your responsibility, not mine :-).

Sub Initialize
    Dim s As New notessession
    Dim db As notesdatabase
    Dim view As NotesView
    Dim doc As NotesDocument
    Dim olddoc As NotesDocument
    Dim subj As String
    Dim newdoc As NotesDocument

    Set db = s.CurrentDatabase
    Set view = db.GetView("($InBox)")
    If Not view Is Nothing Then
        Set doc = view.GetFirstDocument
        While Not doc Is Nothing
            Set olddoc = doc
            Set doc = view.GetNextDocument(doc)
            subj = olddoc.GetFirstItem("subject").Text
            If Instr(subj, "qwertyuiop") > 0  And Right(subj,8) <> " SUCCESS" Then
                Set newdoc = New NotesDocument(db)
                newdoc.SendTo = olddoc.GetFirstItem("inetfrom").Text
                newdoc.subject = subj & " SUCCESS"
                newdoc.form = "Memo"
                Call newdoc.send(True,True)
                Call olddoc.RemoveFromFolder( "($InBox)")
                Call olddoc.PutInFolder( "junk")
            End If
        Wend
    End If
End Sub
share|improve this answer
add comment

I don't know enough about Notes to know whether it is peculiar to the setup at IBM or whether it is a generic problem, but the 'Out of Office' agent we get sends OOO messages to mailing lists, which is anti-social. Consequently, I have it configured to not respond to people sending from external (Internet) email addresses - just to internal (Notes-style) email addresses.

You can spot IBM employees on mailing lists - they're the ones who respond with OOO messages. (There are others too, but ...)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.