Rule for getting spam to junk mail folder

We are using a Symantec product to filter mail but as with most filters it isn’t perfect. We initially set it to delete mail that it identified as spam but had people complaining that it was deleting legit mail.

So we altered the configuration to just mark mail identified as spam with a [SPAM] in the subject. Now people are complaining that they get too much mail marked as spam and they don’t want it in their Inbox.

So now we are looking at possibly creating a rule that checks for messages with [SPAM] and sending it to the Junk Mail folder so mail isn’t deleted completely yet isn’t in their inbox as 95+% of the messages marked spam really aren’t wanted.

We have never created a rule that we want to affect all users like this so we are unsure the best way to implement it. Is there a way to create a rule on the server that each client will use and put their mail identified as spam in their junk mail? Is there a way to create a rule and then push it out to everyone’s client like we do with desktop policies? Would this require us to go to each client and create the rule or copy and paste from somewhere or possibly set up the rule and copy it into an email we send out with some instructions?

Thanks

Subject: Rule for getting spam to junk mail folder

I think I would be looking for a new anti-spam software. We are currently using Spam Sentinel and it is blocking 74% of all incoming mail. I got one piece of spam in my inbox last week and no false positives. This has been the experience of all of my users. Users get a single email every morning with all the spam in their quarantine box and they can release or delete from there. Go to maysoft.com and download a trial version and get rid of symantec. I do not work for Maysoft, but their product works for me.

All this in my humble opinion of course.

Subject: Rule for getting spam to junk mail folder

You can’t please everyone as some want all their SPAM and others like Gregory probably don’t give their email out to everyone, so may not know what the rest of his customers are seeing in terms of SPAM. What is SPAM to you is “pork shoulder and ham” to me! Because of this we tag and pass all SPAM and let the user decide.

So, we wrote a Button. We had the Help Desk mail to everyone saying if SPAM comes in and you want it gone but with the ability to review, click the button. If a new person calls later and says I need it, the Help Desk mails it to them. Not the best , but it does not require any template modification. We are toying with trying to add a SPAM rule and SPAM folder to our template in our 7.0x rollout, but have not perfected it yet. That and it would only work for new mail files, but not with load convert.

Our button creates a folder called SPAM (if none exists) and creates a rule called SPAM that says move the mail to the SPAM folder if it contains the keyword(s) in the subject. You could do the same and just change it to $Junk instead of SPAM. Just be aware that if you have gone from R5 to ND6, you could have some invalid rules in your rules folder due to folks dragging and dropping messages in to the R5 rules folder by mistake (fixed in ND 6). Automating the rule creation task can error out if these bogus rules exist. These bogus rules are easy to spot. They don’t display anything with the rules form and if you look at doc properties, it is clear that it is a mail message.

With this rule you also have to educate customers that if you FWD a piece of SPAM to the Help Desk, it is going to go in the Help Desk’s SPAM (or $Junk) folder unless the sender removes or modifies the keyword. No, you can write mail rule that checks the X-SPAM headers that your SPAM software adds to the email.

Lastly, realize that the $Junk folder does not get deleted like Trash unless the user empties it. To resolve this, we designed "purge rules"and a weekly purge agent, but this requires template changes. Our button also creates a purge rule to purge the SPAM folder of messages over 30 days old.

Subject: RE: Rule for getting spam to junk mail folder

Just to clarify, I get over 150 spam messages a day. I have had the same email address for 7 years and was having a HUGE spam problem just like everyone else…and my blackberry users were ready to kill me.

I don’t know about you, but I don’t have a lot of time to be putting together a hodge-podge system of folders and agents and buttons and such, and then managing it on top of that, so seriously, go to maysoft.com and download the trial version of SpamSentinel. It’s Lotus Notes based with Lotus databases and you can be up and running in 10 minutes. It’s that easy and it blocks 99% of all our spam (even more for me).

Users get an all-encompassing email of their spam messages every morning to which they can release one to their in-box, and users can whitelist and blacklist globally so false positives can go through.

Spam Sentinel has done a great job of taking the admin away from the administrator and giving the power to the users to check spam, create whitelists, etc. Now I don’t even think about it.

My total admin time now is once a month I go into the quarantine.nsf database and clear out the previous month’s messages. That’s it, and my blackberry users love me!

I know there’s a lot of ways to skin this spam cat, but when you find a low-cost tool that solves your problem, I’ll drink that juice any day.

Subject: RE: Rule for getting spam to junk mail folder

Greg: A little voice in my head told me you’d take it that wrong way. We use a stable, effetive SPAM solution too, but outside of Notes so our non-Notes users will be protected as well. With a tag 'n pass policy, we let the user decide not the sys admin or a agreeably witty piece of software. Those that don’t want it can junk it. Those that do, can have it. Just a differnet philosphy based on a different set of users who may use mail in a differnet way.

Subject: RE: Rule for getting spam to junk mail folder

Michael -I hear what you are asking for; a MAIL RULE that will get email marked as Spam into the Junk mail folder. There are a couple of reasons why solving this problem is difficult.

The first is that a client MAIL RULE document ordinarily gets compiled and put into a profile document in the clients mail file (this profile document code is then used by the mail ROUTER before mail is delivered to the client).

The second problem is that when you want to put something into a FOLDER (i.e. the JUNK MAIL folder), the MAIL RULE code uses the UNID of the folder – instead of the name – to process the document. Trust me, this problem is a real pain.

Which is why I wrote a server based application to deal with the problem from a centralized approach. If you are interested, my profile is public. Send me an email and we can discuss the solution that I built, or we can discuss your viable alternatives.

Subject: RE: Rule for getting spam to junk mail folder

I have created a script that copies a rule from a central database and activates it in the users mailbox.

Most of the script is copied from the rules scriptlibrary and modified for my special purpose.

The following script works after the rules is copied to the users maildatabase. It is run from a button in a mail sent to the end user.

It activates the rule that has [spam] as a condition but this can be altered.

Dim db As NotesDatabase

Sub Click(Source As Button)

On Error Goto eh01



Dim uiw As New notesuiworkspace



Dim v As NotesView

Dim regel As NotesDocument

Dim uid As NotesUIDocument



Set db = uiw.CurrentDatabase.Database

Set v = db.GetView("(Rules)")

Call v.Refresh



Set regel = v.GetFirstDocument



While Not regel Is Nothing

	If Instr(regel.getitemvalue("ConditionList")(0), "[spam]") > 1 Then

		Call deaktiver(regel)

		Call aktiver(regel)

		

		Exit Sub

	End If

	

	Set regel = v.GetNextDocument(regel)

Wend



Msgbox "Kunne ikke finde [spam] regelen ! Kontakt IT-Drift",, "Fejl"

eh01exit:

Exit Sub

eh01:

Msgbox "Fejl under afvikling af " + Cstr(Getthreadinfo(1)) + " : " + Cstr(Err) + " " + Error(Err) + " i linie " + Cstr(Erl)

Resume eh01exit

End Sub

Sub deaktiver(note As NotesDocument)

On Error Goto eh02



Dim folder As NotesView

Dim vrulenum As Variant

Dim strfilteritem As String

Dim profile As notesdocument

Dim x As Integer



Set profile = db.GetProfileDocument("CalendarProfile")



If note.getitemvalue("Enable")(0) <> "1" Then

	Msgbox("Reglen/Reglerne er allerede deaktiveret.")

	Exit Sub

End If

vrulenum = note.getitemvalue("ordernum")(0)

strfilteritem = "$FilterFormula_"+Cstr(vrulenum)

If Not(profile Is Nothing) Then

	Call profile.removeitem(strfilteritem)

	Call profile.save(True, True,True)

	Call note.replaceitemvalue("Enable","0")

	Call note.save(True,False,True)

Else

	Msgbox("Kan ikke finde profilen. Reglen kan ikke deaktiveres.")

	Exit Sub

End If

eh02exit:

Exit Sub

eh02:

Msgbox "Fejl under afvikling af " + Cstr(Getthreadinfo(1)) + " : " + Cstr(Err) + " " + Error(Err) + " i linie " + Cstr(Erl)

Resume eh02exit

End Sub

Function FindHighestRule() As Integer

Dim s As New Notessession

Dim folder As NotesView

Dim vec As Notesviewentrycollection

Dim e As Notesviewentry

Dim highest As Integer



Set folder = s.Currentdatabase.Getview("(Rules)")

If folder Is Nothing Then Exit Function



Highest = 0



Set vec = folder.Allentries



If vec.count > 0 Then

	Set e = vec.Getfirstentry

	While Not e Is Nothing

		If highest < e.Columnvalues(1) Then

			highest = Cint(e.Columnvalues(1))

		End If

		Set e = vec.Getnextentry( e )

	Wend

End If

If highest = 0 Then

	highest = 1

End If

FindHighestRule = highest

End Function

Sub aktiver(note As NotesDocument)

On Error Goto eh03

Dim vrulenum As Variant

Dim strfilteritem As String

Dim profile As notesdocument

Dim item As notesitem



Set profile= db.GetProfileDocument("CalendarProfile")

If note.getitemvalue("Enable")(0) = "1" Then

	Msgbox("Reglen/Reglerne er allerede aktiveret.")

	Exit Sub

End If



vrulenum = note.getitemvalue("ordernum")(0)

		'// $FilterFormulaCount is the total number of rules in the db + 1

Call profile.replaceitemvalue("$FilterFormulaCount", Cstr(FindHighestRule() + 1))



strfilteritem = "$FilterFormula_"+Cstr(vrulenum)

If Not(profile Is Nothing) Then	

	Set item=note.getfirstitem("$FilterFormula")				

	If Not(item Is Nothing) Then 

				' test for the existence of the $FilterFormula_x - if it is there, remove it

		If Not(profile.hasitem(strfilteritem)) Then

			Call item.copyitemtodocument(profile,strfilteritem)

		Else

			Call profile.removeitem(strfilteritem)

			Call item.copyitemtodocument(profile,strfilteritem)

		End If

		Call note.replaceitemvalue("Enable","1")

				' save the note

		Call note.save(True,False,True)

	End If

Else

	Msgbox("Kan ikke finde profilen. Reglen kan ikke aktiveres.")

	Exit Sub

End If



Call profile.save(True, True,True)

eh03exit:

Exit Sub

eh03:

Msgbox "Fejl under afvikling af " + Cstr(Getthreadinfo(1)) + " : " + Cstr(Err) + " " + Error(Err) + " i linie " + Cstr(Erl)

Resume eh03exit

End Sub

Subject: Rule for getting spam to junk mail folder

Server rules can’t access user folder, so you have to go with user rules. I don’t believe that policies can help you with pushing the rules down to the users. Theoretically, though, one can write code to put the appropriate rule in each user’s mailbox. It will be tricky. I’ve never tried it, but it should be possible. Rules are just ordinary documents.