OK, I have put together an agent to forward mail, it is supposed to remove any large attachment and include some data.
When run manually in the UI it works perfect, however when set to run "Before mail arrives" it only forwards mail without any attachments...
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
Dim atta As String
Dim remo As String
' **** set to the address that you would like to forward mail to, maxsize of attachements ****
forwardaddress = "email@example.com"
Const MaxSize = 3000000
Set db = s.currentdatabase
Set doc = s.DocumentContext
Set forward = New NotesDocument(db)
Call doc.CopyAllItems(forward, True)
Set rtitem = forward.GetFirstItem( "Body" )
'determine if any attachment exist, remove them if they are to big
atta = "no attachments included"
remo = ""
If Not Isempty (rtitem.EmbeddedObjects) Then
atta = ""
Forall o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) And (o.FileSize > MaxSize) Then
remo = "removed attachment: "
atta = atta + o.source + ", "
'navigation element in order to place header in front of body text
Set rtnav = rtitem.CreateNavigator
'print recipients into the new mail heading
'all kinds of data inserted here as texts
forward.Send False, forwardaddress
Can someone please solve this?
I have also tried to set the agent to run "after new mail has arrived" on all new mail messages but then nothing gets forwarded...
March 12, 2009 3:42 PM
March 13, 2009 1:35 PM