I found this forwarding agent in searchdomino.com. Can anyone tell me how do I modify the example so that the agent forward mail documents without any attachments? Please help me to modify the script. Thanks.
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim forward As NotesDocument
Dim forwardaddress As String
Dim rtitem As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
forwardaddress = “recipient@test.com” 'set to the address that you would like
to forward mail to
Set db = s.currentdatabase
Set doc = s.DocumentContext
Set forward = New NotesDocument(db)
Call doc.CopyAllItems(forward, True)
Set rtitem = forward.GetFirstItem( “Body” )
Dim newtext As String
Set rtnav = rtitem.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) 'navigation element in
order to place header in front of body text
Dim nn As New NotesName(doc.GetItemValue(“From”)(0)) 'determines if this is
an internal message or not
Dim cc As New NotesName(doc.GetItemValue(“CopyTo”)(0))
Dim sto As New NotesName(doc.GetItemValue(“SendTo”)(0))
'Set up a header that will be attached to the email which specifies additional
info about the original email
Dim testcopy As String
If doc.GetItemValue(“CopyTo”)(0) = “” Then
testcopy = “no one.”
Else
Forall x In doc.GetItemValue(“CopyTo”)
If testcopy = Null Then
testcopy = x
Else
testcopy = testcopy + x + ", "
End If
End Forall
End If
If nn.IsHierarchical Then 'if it is then get their internet address
If nn.Addr821 <> Null Then 'if they have one then use this as the from
address
Call rtitem.BeginInsert(rtnav)
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText( "Original message sent to " + sto.Addr821 + " and
copies were sent to " + testcopy)
Call rtitem.AddNewLine( 3 )
Call rtitem.EndInsert
Call forward.RemoveItem(“CopyTo”)
Call forward.RemoveItem(“BlindCopyTo”)
Call forward.ReplaceItemValue(“From”, nn.Addr821)
Call forward.Save( True, True )
Else
Call rtitem.BeginInsert(rtnav)
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText( "Original message sent to " + sto.Addr821 + " and
copies were sent to " + testcopy)
Call rtitem.AddNewLine( 3 )
Call rtitem.EndInsert
Call forward.RemoveItem(“CopyTo”)
Call forward.RemoveItem(“BlindCopyTo”)
Call forward.ReplaceItemValue(“iNetFrom”, nn.Addr821)
Call forward.Save( True, True )
End If 'otherwise if this is an internal message and the internet address of
that user is not populated, use the agent signer’s return address
Else
Call rtitem.BeginInsert(rtnav)
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText( "Original message sent to " + doc.GetItemValue
(“SendTo”)(0) + " and copies were sent to " + testcopy)
Call rtitem.AddNewLine( 3 )
Call rtitem.EndInsert
Call forward.RemoveItem(“CopyTo”)
Call forward.RemoveItem(“BlindCopyTo”)
Call forward.ReplaceItemValue(“iNetFrom”, doc.GetItemValue(“From”)
(0)) 'otherwise this came in from the internet, so just use the from address
as the inetfrom
Call forward.Save( True, True )
End If
forward.Send False, forwardaddress
Call forward.RemovePermanently(True)
End Sub