Mail button to Create a Mail Rule using LotusScript

Hi,

Just trying to implement a new “global” client side mail rule in our office.

I want to send out a button in an email that creates a mail rule and also sends an email to an admin account so that I know the code has run. I have tried the below code and the resulting document is not recognised as a Mail Rule…

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument 



Set db = session.CurrentDatabase

Set doc = db.CreateDocument



doc.<lots of fields> = value

    'repeating above line...'



Call doc.Save( True, True ) 

End Sub

I can work out the mail me bit - easy enough. The other thing I though about doing was using the esisting script lib. in all mail files “Rules” but I couldn’t work out how to reference it in a button type email.

Cheers.

Subject: Mail button to Create a Mail Rule using LotusScript

I’ve not done any work with trying to create mail rules programmatically, but I have a couple of questions. Are you setting the form field of the new doc to ‘Mailrule’? Are you using a putinfolder command to put the rule into the (Rules) folder?