Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


tsprks
2022-09-29T21:37:06Z
In preparation for Office365 disabling basic authentication I finally worked on getting my cron email account moved over to using EWS. I followed the steps exactly and actually got it working. I migrated all my jobs over to the new method and then about an hour later I started getting emails that my email triggers were deactivated. In the end every single job that used an email trigger that had been moved over to EWS was deactivated. I can go back in and reactive them and they will work again for about an hour, but then again will deactivate. I'm not sure what's going on and need help. Oddly the emailing sending still works perfectly, but the email triggers that check the Inbox (and I tried the "default") folder all fail. This is the error that is being sent to me:

Trigger 'Email Trigger. Monitoring folder ''default'' subject contains 'FedEx Shipment'. ' was inactivated in Job 'FedEx Email' by error 'ReceiveMail->Error in Mail Trigger (3), ex: System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at EAGetMail.MailClient.?(MailServer ?, Byte[] ?, ? ?, MailInfo ?, HeaderCollection ?, String ?)
at EAGetMail.MailClient.?(MailServer ?, String ?, String ?, ? ?)
at EAGetMail.MailClient.Connect(MailServer server)
at ConnectionVal.DeleteManager(Object , MailServer , ConnectionVal )
at VisualCronService.EventMailClass.ReceiveMail() in C:\git\code\VisualCronService\Triggers\Events\Mail\clsEventMail.vb:line 1575, oClient null = False'

Ideas? I need this fixed ASAP obviously since this is now the only way to read Office365 emails.
Sponsor
Forum information
thomas
2022-09-30T06:25:00Z
Hi

This has been a big problem for us also. I made a few changes that have made things a lot more stable. Unfortunaltely I have no idea which one of these actually made a difference. I would add images but there is a bug on this website now. It is no longer possible to copy/paste images here (please fix this support)

1) I changed the mailtrigger to check every 60 seconds (it was previously 30). I don't believe this was the critical change to be honest

2) I changed the timeout on the Exchange EWS connection to 120. It was 60 by default

3) I changed the mailtrigger error handling. In the mailtrigger itself, go to the email tab. Under error handling i set the connection timeout to 1000, and number of retries to 5.

Before these changes, the trigger would inactivate every hour, like in your case. After these changes the trigger has been active for 2-3 days now.
tsprks
2022-09-30T14:13:27Z
I made all the changes you mentioned and everything is still getting disabled. At this point I wish someone from VC would comment, because today is the last day for basic authentication and I have to be able to check this Inbox reliably. I would have preferred to continue to just use IMAP4, but that only works with Google.
thomas
2022-09-30T14:46:17Z
Well that sucks . We are changing to oauth this weekend also (only in test so far). It is hard to say if this is a VC bug or something else. It could be that this new office365 with oauth connection does not like to be pinged that often and therefore returns an error, if that makes sense. I will add more triggers to the test environment and see if that changes things.

If you are desperate, you can try to check the 'keep connection' box in the trigger. I have never tried this myself and not sure what it actually does

Thomas
thomas
2022-10-02T22:02:57Z
Here is my guess at what is happening. See link below, section about Access token lifetime.

https://learn.microsoft....ns#access-token-lifetime 

A token has a lifetime of 1-2 hours. I verified this by running in Postman and getting the access token. It has an expiry of 3600 seconds. (no longer able to upload images to this forum, so cannot show...)

My guess is that the trigger initially gets a token, and then keeps it around for everytime it needs to connect. It then 'forgets' to renew the token, and we get a 401 error, as it is sending a token that has expired. The trigger is deactivated, and when you reactivate, you get a fresh token, and so on. Adding a retry to the trigger has no effect, since it is retrying with the same expired token.

If this is correct, the short term solution is to create a job that has a trigger that fires on deactivated triggers in other jobs. When it fires, reactivate the jobs with mailtriggers. It is not pretty, but is the only viable solution until this has been fixed.

Thomas
tsprks
2022-10-04T12:15:14Z
That makes sense. I'll setup a job and test that. For now I've gotten the extension from MS to keep using IMAP for the time being.
tsprks
2022-10-04T12:26:42Z
So I started looking at how to reactivate a trigger once it was deactivated and I'm not sure it's actually possible. At least not without using specific reactivation jobs for each job. I currently have a generic Trigger Deactivated job that sends me an email anytime a trigger is deactivated, I'd hope I could just have it reactivate whichever trigger started the job, but there doesn't seem to be a way to do that using variables.
thomas
2022-10-04T17:55:16Z
I believe you have to create one task for each task of the mailtriggers that need to be actived. It is not possible to based on variables. It would be nice if one could actived a trigger based on it's Id, but this is not possible as far as I know
ComputerGuy79
2022-10-19T00:20:15Z
We've run into this issue as well.. I'm trying a possible workaround but it's not yet complete.
Michael Fjellström
2022-11-08T12:25:42Z
Yes, this was due to the token lifetime, which we have fixed now in the latest version 9.10.12 - please download that version and it should work.

If it for some reason doesn't, send an email to support@visualcron.com
Scroll to Top