Home > Domino Tips > Developer > Agent > Mail rules for POP mail
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

AGENT

Mail rules for POP mail


Thomas Ozenne
12.09.2002
Rating: -3.00- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Each day I get mail from pop accounts to my mail box , but as you may have noticed Mail Rules are applied on the Domino Router not in Mail dbs , to have Lotus Process my rules for the non server incoming mail I did setup a small agent which if able to process simples rules ( multiple Field contains selection & single Action move to folder ...). Paste the code in a new agent in your mail db have it run against all new modified documents and here you go:



Code

Sub Initialize
 'This scrip will process locally Simple mail rules based on a 
condition and simple Move to folder actions 'Works with R6 mail template english , should work in R5
'For other language this would require a few more Replacesubstrings Dim lang As String lang = "move to folder" Dim s As notessession Dim db As notesdatabase Set db = New notesdatabase("","") Dim vue As notesview Set vue = db.GetView("(Rules)") Dim inbox As notesview Set inbox = db.GetView("($Inbox)") Dim mrules As notesdocument Dim valu As String Dim qry As String Dim temp As Variant Dim col2 As notesdocumentcollection Set mrules = vue.GetFirstDocument If mrules Is Nothing Then Print "No rule to process" Exit Sub End If Do While Not mrules Is Nothing If Instr(mrules.actionlist(0),lang)>0 Then movefolder= Trim(Strrightback(mrules.actionlist(0),lang)) qry = "" Forall a In mrules.conditionlist valu = {temp:=@ReplaceSubstring("} & a &
{";"Sender";"FROM");@If(@Contains(temp;"AND");"
AND "+@ReplaceSubstring(temp;"AND";"Field ");@Contains(val;"OR");" OR "+@ReplaceSubstring(temp;
"OR";"Field ");"Field " + temp)}
temp =Evaluate(valu) qry = qry & " " & temp(0) End Forall Set col2 = db.Ftsearch(qry, 0, 0) If col2.Count > 0 Then Call col2.PutAllInFolder(movefolder,False) Call col2.RemoveAllFromFolder("($Inbox)") End If End If Set mrules = vue.GetNextDocument(mrules) Loop End Sub

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Agent
Open documents in Lotus Notes from the Web without a UNID
Fix and update Lotus Notes documents with limited access
Verify scheduled agent status with Domino Extensible Language (DXL)
How to export data from a Lotus Notes database to a CSV file
Enable or disable scheduled agents without opening the Lotus Notes database design
Creating custom views in Lotus Notes databases
Editing fields in a Lotus Notes view with Ajax
How to automatically create a backup copy of your Domino Directory
Export Lotus Notes documents to Microsoft Word via Internet Explorer
A bevy of Notes/Domino development tips

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts