Counting mails into a certain mailfile

I have a spam mail database set up. Is it possible to have an agent run once a day which will count how many mails have been received in 24 hours and mail the answer somewhere?

Thanks,

Phil.

Subject: Counting mails into a certain mailfile

Sure, this can be done with a simple actions agent.

Create a new agent and name it to something useful.

Set the agent to run either daily or manually triggered.

Set the target to be “All documents in database”.

In the “Document selection”; enter a new condition and set it to be “By Date” and “Search for documents whose…” to be “date created is in the last 1 day(s)”.

In the “Action”; Create a new action and choose “Send Newsletter Summary” and enter the name of the person(s) and/or group(s) that should receive the mail, and also add a subject and a description. Check the “Include summary…” option and choose a view/folder that holds the info that You like to see on the mail.

Also: Check the option “Gather at least 1 document(s) before mailing”.

done.

…[Edit]…

oh… when reading Your question once more - I realized that You wanted only the COUNTING of the mails… Well… That can be done by LotusScript. Hold on and I’ll create it…

…[Edit #2]…

Here is the script to put into an agent:

Dim sess As New NotesSession

Dim db As NotesDatabase

Dim coll As NotesDocumentCollection

Dim cutOff As NotesDateTime



Set db = sess.CurrentDatabase

Set cutOff = New NotesDateTime(Now)

Call cutOff.AdjustHour(-24)



Set coll = db.Search(|SELECT Form="memo"|,cutOff,0)

If coll.Count > 0 Then

			Set maildoc = New NotesDocument(db)

	maildoc.Form = "memo"

	maildoc.SendTo = "anyone"

	maildoc.Subject = "Here is the count"

	maildoc.CreateRichTextItem("Body")

	Set rtItem = maildoc.GetFirstItem("Body")

	rtItem.AppendText("Count of mail: " & Cstr(coll.Count))

	rtItem.AddNewline(1)

	rtItem.AppendText("Regards, The Agent")

	maildoc.Send(False)



End If

or something like that…

hth

Subject: RE: Counting mails into a certain mailfile

Thanks Kenneth, trying that now.

Phil.

Subject: Counting mails into a certain mailfile

Phil,write a lotus agent that runs onthe dB once a day.

in the script use the notesTimer class to get a period 24 hours before today.

build your collection of document using dB.search( “select form = “memo” & @created <= [start date] & @created <= [end date]”

this will give you how many emails

build a memo and then send it along.

should take you more than 15 minutes if you are pretty good w/script

hth

john

Subject: RE: Counting mails into a certain mailfile

I don’t know the first thing about script, hence my question :slight_smile:

Thanks!