Prevent auto-reply agent from looping

Hi everyone,

I’ve managed to piece together an auto-reply agent for myself. I didn’t use the ‘simple action’ because I wanted to set my own subject line, which isn’t an option there.

I’ve tested the agent and it seems to work well, the only thing I would now like to do is add a condition that pervents the agent from replying to emails which are replies to the agent.

I run the agent ‘before new mail arrives’ and I currently have the condition:

If (Not note Is Nothing) Then

Set replyemail = New NotesDocument(db)

and so on…

In the agent I am setting the subject line - let’s say it’s “Email received”. Could I then add an addition to this If which will check for subject containing ‘Email received’? If so, can anyone point me to a good reference for the syntax? I’m inexperienced with lotuscript.

thanks for any input,

Dan

Subject: Prevent auto-reply agent from looping

Great, thank-you!

Subject: RE: Prevent auto-reply agent from looping

Hello, just following up on this thread…

I’m finding that if I manually reply to my agent’s auto-reply email, then the agent will still auto-reply to me. !

ie. it seems that the ‘SentbyAgent’ property isn’t being picked up in this scenario. I was hoping that the agent would not reply to an email which is part of an email thread that it started. Is this working by design, or is there something I need to do?

If the ‘SentByAgent’ property only picks up when the user’s reply is generated by Out-of-Office or something similar, then does this work for only Notes-agents, or will it recognize emails auto-generated by Outlook and other mail clients?

thanks,

Dan

Subject: Check for the “$AssistMail” item

All emails generated by agents contain a special item called $AssistMail with the text value of “1”.

So, use the following sample code…

const ITEM_AGENT_EMAIL = “$AssistMail”

if not notesDocument.HasItem(ITEM_AGENT_EMAIL) then

…do your stuff

end if

Subject: RE: Check for the “$AssistMail” item

No need to look at internal flags :slight_smile: There is a property SentByAgent which will return boolean true if it was originated by an agent! This way you will protected if we ever change the internal represenation for this.

Subject: Good point! Should’ve known better :wink:

I didn’t know about that property, maybe it got added after I got used to ckecking for the item name directly :wink: