Here I post my code to help someone who want to do the same thing. The code is in an pre-delivery mail agent.
Sub initialize
Dim session As New NotesSession
Dim doc As NotesDocument
Dim db As NotesDatabase
Dim it As NotesItem
Dim plaintext As String
Dim erreur As String
Dim subj As String
Set session = New NotesSession
Set sourcedb = session.CurrentDatabase
Set db = session.CurrentDatabase
Set doc = Session.DocumentContext
Set rtitem = doc.GetFirstItem("body")
plaintext = rtitem.text
'Write in a file
fileNum% = Freefile()
fileName$ = "C:\TEMP\filename.txt"
Open fileName$ For Output As fileNum%
Print #fileNum%, doc.Subject(0)
Print #fileNum%, plaintext
Close fileNum%
End sub

