Workflow and ServiceDesk Community

 View Only
  • 1.  Email Monitor dies when from = null

    Posted Dec 27, 2013 01:01 PM

    The SD.Email.Monitor service works great for us. However, when we get a bounce from certain post masters, the from address is not populated. When this happens, the service crashes with the following exception:

    System.Argument"Out"OfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

    The component that throws this is LogicBase.Components.IMAP4.IMAP4GetComponent. I tried using the LogicBase.Components.IMAP4.IMAP4ListComponent component then looping through all of the messages to delete the ones that have null from, however, this component throws the same exception.

    Once I manually delete the messages that have no from address in the mailbox, the service starts running fine again.

    Any ideas? For now I am leaving an outlook client up with a rule that deletes them as a work-around until a better solution is found.

    Thank you,

    Dustin Perkins



  • 2.  RE: Email Monitor dies when from = null

    Posted Dec 30, 2013 09:29 AM

    If it is acceptable to delete the messages with a null From Address, you could try adding an Exception Trigger component to catch the error when it is thrown.  Following the Exception Trigger add two Text Equals Rule(s) to see if the  ExceptionComponentName equals the IMAP4ListComponent and that the ExceptionTriggerMessage equals the out of range message. 

    If both conditions are met, add the logic to deal with the bad message then return to the loop. 

    You may need to add a Variables Exist component to ensure you have access to the current message in the collection you are looping through.

    Be careful when removing items from a collection as it will impact the array.count.  It may be better to mark the item for deletion during the loop then follow the loop with a Configurable Collection Filter component to clean up the collection.



  • 3.  RE: Email Monitor dies when from = null

    Posted Dec 30, 2013 10:12 AM

    I do not beleive I have access to the message when this exception is thrown because the component that would grab the message for me so that I know the message ID is the one that is crashing.

    What do you think?

    Thanks



  • 4.  RE: Email Monitor dies when from = null

    Posted Dec 30, 2013 10:57 AM

    I haven't used the IMAP4Get component so I'm not sure exactly how it works.  If you have checked the Delete After Retrieve checkbox you could simply have the Exception process I described return to the IMAP4 Get component after verifying the ExceptionComponentName and ExceptionTriggerMessage.

    If you are not using the Delete After Retrieve option, you can try to re-engineer your process somewhat. 

    I found a discussion at https://www-secure.symantec.com/connect/forums/email-inbox-monitor which included the following:

    2. Use the "IMAP4 List" component (or POP3 List) to gather unread messages from your Exchange inbox.  This will give you an array of the messages in the inbox.  You will have to be able to connect via IMAP or POP for this to work.

    3. Use the "For Each Element In List" component to setup a loop to go through the array of email messages.  This will give you the "EmailHeaderType", which includes the Email ID.

    4. Use the "IMAP4 Get By Id" component to get the contents of each message in the list.  You use the Email ID from the For loop to get the contents of the message.  Then you can do whatever you want with the contents.

    ----------

    If the IMAP4 List component is able to process the messages that lack a From Address you would have access to the Email ID of each message as it is being processed (in the loop).  If a message generates an exception, you could use the IMAP4 Delete By Id component to remove it (after  verifying the ExceptionComponentName and ExceptionTriggerMessage)



  • 5.  RE: Email Monitor dies when from = null

    Posted Dec 30, 2013 12:32 PM

    I'm afraid the "IMAP4 List" component fails to execute with the same error. Setting the delete after retrieve checkbox doesn't help because it can't get the messages anyway. I tested that and the message remains in the mailbox.

    The only thing I've been able to do is have a server-side rule on the mailbox that deletes the message if the subject = "delivery status".