Robotic Process Automation (RPA)

 View Only
  • 1.  IMAP Read mail

    Posted Thu November 25, 2021 03:28 AM
    Hi,

    I try to read emails with a connection to the IMAP server.
    When the script starts I received an error on For each function.
    Could you help with what this error is?

    MailKit.Net.Imap.ImapProtocolException: Syntax error in BODYSTRUCTURE. Unexpected token: ')'
    at MailKit.Net.Imap.ImapUtils.ReadNStringToken(ImapEngine engine, String format, Boolean rfc2047, CancellationToken cancellationToken)
    at MailKit.Net.Imap.ImapUtils.ParseContentType(ImapEngine engine, String format, CancellationToken cancellationToken, ContentType& contentType, String& value)
    at MailKit.Net.Imap.ImapUtils.ParseBody(ImapEngine engine, String format, String path, CancellationToken cancellationToken)
    at MailKit.Net.Imap.ImapUtils.ParseBody(ImapEngine engine, String format, String path, CancellationToken cancellationToken)
    at MailKit.Net.Imap.ImapUtils.ParseMultipart(ImapEngine engine, String format, String path, String subtype, CancellationToken cancellationToken)
    at MailKit.Net.Imap.ImapUtils.ParseBody(ImapEngine engine, String format, String path, CancellationToken cancellationToken)
    at MailKit.Net.Imap.ImapFolder.FetchSummaryItems(ImapEngine engine, ImapCommand ic, Int32 index)
    at MailKit.Net.Imap.ImapEngine.ProcessUntaggedResponse(CancellationToken cancellationToken)
    at MailKit.Net.Imap.ImapCommand.Step()
    at MailKit.Net.Imap.ImapEngine.Iterate()
    at MailKit.Net.Imap.ImapEngine.Wait(ImapCommand ic)
    at MailKit.Net.Imap.ImapFolder.Fetch(IList`1 uids, MessageSummaryItems items, CancellationToken cancellationToken)
    at MailKit.MailFolder.<>c__DisplayClass175_0.<FetchAsync>b__0()
    at System.Threading.Tasks.Task`1.InnerInvoke()
    at System.Threading.Tasks.Task.Execute()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at WDG.Automation.Base.ImapClient.<InternalFetchMessages>d__11.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at WDG.Automation.Base.MailClientBase.<FetchMessages>d__81.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at WDG.Automation.Base.MailClientBase.q1oJIUe36EuXu9iowWh.<MoveNextAsync>d__8.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at WDG.Automation.Base.ForeachCommand.<Execute>d__23.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at WDG.Automation.Language.ErrorHandler.b9qdpRorAX(Exception )
    at WDG.Automation.Language.ErrorHandler.HandleExecutionExceptionIfNeeded(Exception exception, IAutomationCommand command)
    at WDG.Automation.Language.CommandInterpreter.<Run>d__12.KiuaZ4S3N3WHAgRjZtC(Object , Object , Object )
    at WDG.Automation.Language.CommandInterpreter.<Run>d__12.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at WDG.Automation.Language.ScriptInterpreter.<RunCore>d__17.MoveNext()

    Thank you!

    Best regards,

    ------------------------------
    Stanislav Terziev
    ------------------------------


  • 2.  RE: IMAP Read mail

    Posted Wed December 01, 2021 09:21 AM
    It seems the IMAP server is sending something wrong in the body structure. Which server are you connecting to? (gmail, outlook, other? )
    Also, enable the "enable log" parameter (https://www.ibm.com/docs/en/rpa/21.0?topic=email-connect-imap-server) to get more details on the error. Use this log, which is located in %localappdata%\IBM Robotic Process Automation\imap.log to open a support case in IBM Support.

    ------------------------------
    Joba Diniz
    Product Manager
    IBM
    ------------------------------