Link to home
Start Free TrialLog in
Avatar of AlainLimoges
AlainLimoges

asked on

insert file text attachment in a body field

I receive mails with file TXT attachments
I want to modify the body field of this mail by adding the content of this TXT file attachment

any idea ?
Avatar of scottrma
scottrma

You could write a new mail agent to look for .txt file attachments in your incoming mail, and if they are found, detach them, then read their contents into memory and write (append) the contents to the Body field of the email.
Avatar of AlainLimoges

ASKER

have you a script exemple, I'm not specialist of LotuScript
have you a script exemple, I'm not specialist of LotuScript
have you a script exemple, I'm not specialist of LotuScript
Set s = New NotesSession
Set db = s.CurrentDatabase
Set col = db.UnprocessedDocuments
Set doc = col.GetFirstDocument

While Not (doc Is Nothing)

     Forall o in doc.EmbeddedObjects

          If o.Type = EMBED_ATTACHMENT And Lcase$(Right$(o.Name,4)) = ".txt" Then

               s.ConvertMime = True
               Set body = doc.GetFirstItem("Body")

               FilePath$ = "C:\temp\" & o.Name
               Call o.ExtractFile(FilePath$)
               FileNum% = FreeFile()
               Open FilePath$ For Input As FileNum%

               Do While Not EOF(FileNum%)

                    Line Input #FileNum%,temp$
                    Call body.AppendText(temp$)
                    Call body.AddNewLine(1)

               Loop

               Call doc.Save(True,False)
               Close #FileNum%
               Kill FilePath$

          End If

     End Forall

     Set doc = col.GetNextDocument(doc)

Wend
ASKER CERTIFIED SOLUTION
Avatar of scottrma
scottrma

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
ok thanks a lot