lotus agent “ingore” mails with attachments when event triggered

10 pts.
Tags:
Lotus Agents
Lotus Notes errors
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... The code: 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 Dim atta As String Dim remo As String ' **** set to the address that you would like to forward mail to, maxsize of attachements **** forwardaddress = "mine@outside.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 + ", " Call o.Remove Call forward.Save(True,True) End If End Forall End If 'navigation element in order to place header in front of body text Set rtnav = rtitem.CreateNavigator Call rtnav.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) 'print recipients into the new mail heading Call rtitem.BeginInsert(rtnav) 'all kinds of data inserted here as texts Call rtitem.EndInsert Call forward.RemoveItem("CopyTo") Call forward.RemoveItem("BlindCopyTo") forward.Send False, forwardaddress Call forward.RemovePermanently(True) End Sub 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...
ASKED: March 12, 2009  3:42 PM
UPDATED: March 13, 2009  1:35 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Complete shot in the dark here. Given your use of constants like EMBED_ATTACHMENT and RTELEM_TYPE_TEXTPARAGRAPH, is it possible they aren’t resolving properly on the server, but are working okay on the client? What happens if you replace them with their actual values?

Also, have you checked security settings to ensure that your code can run on the server?

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Brooklynegg
    Also, is an error appearing in the log? If there are errors and no error handling in the agent, they should write to the server log.
    3,845 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following