Link to home
Start Free TrialLog in
Avatar of anik
anik

asked on

How to get the mail to delete itself?

Can I get the mail to delete itself right after it was read?
Avatar of mchampou
mchampou

Hello Anik, just copy paste the following code into the event Terminate of your form "memo" :

     Dim NUIWs As New NotesUIWorkspace
     Dim NUIDoc As NotesUIDocument
     Dim Retour As Variant
     
     Set NUIDoc = NUIWs.CurrentDocument
     
     If (NUIDoc.IsNewDoc = False) Then
         
          Retour = Messagebox ("Do you want to delete this memo ?", 68, "Delete memo ?")
         
         
          If Retour = 6 Then
               Call NUIDoc.DeleteDocument
          End If
     End If


Please keep in mind that you have to turn of "inheritance" for the form memo otherwise the change will be overwritten at 1am by the Designer task.

Also keep in mind that this will only mark the document for deletion, not eradicate it from your mail file.

If this is not the answer you are looking for reject it, if you need more precisions, let me know =)

Sincerely,

mchampou
Avatar of anik

ASKER

Sorry for my unclear question.
What I want is when I send the mail to someone. I want it to delete after he/she read it.  
I think u r probably concerned about security...there is a functionality that lets u disable copying printing or forwarding of the email under the delivery options
Hello, Anik, pls reject this answer "again" if it does not help you ... here's the steps you'll take :

1. Go into the desing of your mail database
2. Go to the forms
3. Select the form "Memo" and copy-paste it
4. Rename the new form "Self-Destruct Memo" or something (you'll have to double-click it and put it in design mode to rename it).
5. Go into the form properties and select "Store Form"
6. In the "Terminate" event of your memo, paste the following code :

Dim NUIWs As New NotesUIWorkspace
Dim NUIDoc As NotesUIDocument
Dim Retour As Variant
     
Set NUIDoc = NUIWs.CurrentDocument
     
If (NUIDoc.IsNewDoc = False) Then
    Call NUIDoc.DeleteDocument
End If

Unfortunatly, the memo will only be "marked for deletion" not deleted. Perhaps Ghassan could fill the "remaining" ...

I've got this idea about the terminate event where you'd store the document unid in a variable, after the "Call NUIDoc.DeleteDocument", you'd get the database to give you the same doc using "Database.GetDocumentByUNID" and then you'd delete the doc.

Anyway I'm thinking to myself that there is probably an easier way =)

Have a good day,

mchampou
Avatar of anik

ASKER

Wow!! Thanks a lot. That's what I want.
Avatar of anik

ASKER

Can you put as answer mchampou?
ASKER CERTIFIED SOLUTION
Avatar of mchampou
mchampou

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial