during conversion Windows Legacy projects into Windows (compatible with .Net6) I run into a problem with getting a list of Emails, from company’s Outlook mailbox.
Previously (.Net 4) I was using an activity: “Get Exchange Mail Messages” and it worked perfectly, but since it’s not available anymore in new projects, I had to replace it with something else, so I try with “Get IMAP Mail Messages” activity, but still with no luck:
I’m getting an error: “Login Failed”, but I know that credentails, that I use are correct, also I’ve read on the forum the error is pretty generic and could be connected with other things, such as security settings, IP allowance-permision, SSL connection and more.
Our IT claims the IMAP service is on for the target mailbox. I have a feeling, that the problem is somehow connected with SSL settings - with previously used activity (“Exchange”), there was no SSL settings to be set and everything was working - please help.
Regards, Peter.
MailKit.Security.AuthenticationException: LOGIN failed. at MailKit.Net.Imap.ImapClient.d__103.MoveNext() in D:\src\MailKit\MailKit\Net\Imap\ImapClient.cs:line 1250
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MailKit.Net.Imap.ImapClient.Authenticate(Encoding encoding, ICredentials credentials, CancellationToken cancellationToken) in D:\src\MailKit\MailKit\Net\Imap\ImapClient.cs:line 1320
at MailKit.MailService.Authenticate(ICredentials credentials, CancellationToken cancellationToken) in D:\src\MailKit\MailKit\MailService.cs:line 1237
at UiPath.Mail.UiPMailKit.Extensions.IMailServiceExtensions.Authenticate(IMailService service, UserSettings userSettings, CancellationToken cancellationToken)
at UiPath.Mail.MailServiceFactory.CreateMailKitService(EmailProtocol protocol, String server, Int32 port, UserSettings userSettings, SecureSocketOptions options, Int32 timeout, CancellationToken cancellationToken)
at UiPath.Mail.MimeMailService.GetIMAPMessages(UserSettings userSettings, ServerSettings serverSettings, Int32 top, String mailfolder, String filterExpression, String charset, EOrderByDate orderByDate, SecureSocketEncryption SecureConnection, Boolean deleteMessages, Boolean onlyUnreadMessages, Boolean markAsRead, Action1 logAction, CancellationToken cancellationToken) at UiPath.Mail.IMAP.Activities.GetIMAPMailMessages.<>c__DisplayClass76_0.<GetMessages>b__0() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Mail.Activities.Extensions.TaskExtensions.d__1`1.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Mail.Activities.GetMailActivity.d__13.MoveNext()
— End of stack trace from previous location where exception was thrown —
at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
Can you try changing the mail activity version and check if it solves…does not look purely authentication issue…and i see a no reply mail box…that you are using…does that have any restrictions?
I would strongly recommend using a different type of authentication since Microsoft is deprecating basic authentication this month. Instead, you may use “Get Outlook Messages” that connects using the current outlook profile on the machine, no authentication needed as it goes through whatever settings you have setup.
Also, you may also consider using the O365 activities scope.
I tried to downgrade UiPath Mails dependency but it didn’t help.
Using “Get Outlook Mail Messages” activity gave me the emails list that I wanted, but as I understand, it needs the Outlook application to be installed on the machine, where I want to run a Robot?
Is there any way to manipulate the Emails without having Outlook installed first?
Thank you all for your support and help! After trying mentioned above methods, I’ve found out some replacements for IMAP or Exchange activities, which I would like to share with others in similar situation:
Possible solutions (.Net6):
Microsoft Office 365 Scope + Get Mail activity.
UiPath needs to be registered on https://portal.azure.com/ + proper Mail read/write permissions need to be added.
Use Outlook 365 + For Each Email activity.
Need to login to target mailbox account (as I understad, this could be done also via Orchestrator\Integration Service by adding a connection there).
Get Outlook Mail Messages activity.
Outlook application needs to be installed and configured on target desktop, where Robot is running.
I will recreate old (Legacy) projects and try to go with option 1 or 2, best regards.
Peter