Hi I am creating an agent which will forward the mails,and i have set it on after new mail arrives.But it does not work,I am also pasting the code.I am writing script b’coz i want exact subject in the subject line. I tried to create the agent from send mail ,but i still don’t know whether from there i can send the mail and can get the exact subject.
Sub Initialize
Dim ws As New notesuiworkspace
Dim session As New NotesSession
Dim uidoc As notesuidocument
'Dim note As NotesDocument
Dim dbug As NotesLog
Dim db As NotesDatabase
Dim it As NotesItem
Dim dt As Variant
Set session = New NotesSession
Set sourcedb = session.CurrentDatabase
Set uidoc=ws.CurrentDocument
Set doc=sourcedb.UnprocessedDocuments
Count = doc.Count
REM Log steps in our processing for debug purposes
Set dbug = New NotesLog("Router log")
dbug.LogActions = True
dbug.OpenAgentLog
dbug.LogAction("begin")
Set db = session.CurrentDatabase
REM Make sure we have the note set correctly
If db Is Nothing Then dbug.LogAction("db is not set") Else dbug.LogAction("db is set")
Set view=db.getview("($VIM23)")
Set note = view.Getlastdocument
Set mdoc = New NotesDocument( db )
Dim rtitem2 As NotesRichTextItem
Set rtitem2 = New NotesRichTextItem( mdoc, "Body" )
mdoc.Form="Memo"
mdoc.SendTo="dali@yahoo.com"
mdoc.Subject="FWD:-"+note.subject(0)
Call rtitem2.AppendText(note.Body)
Call mdoc.Send(True)
Call session.UpdateProcessedDoc(note)
dbug.Close
End Sub