IMAP Server not working

Posted on
Sun Dec 26, 2021 6:21 pm
kennybroh offline
Posts: 531
Joined: Dec 13, 2009
Location: Baltimore

IMAP Server not working

I've tried just about everything but I cannot seem to get the IMAP server to work properly. It's for Gmail. The settings are as specified by Google and IMAP is enabled in Gmail..

The device status shows as "Failure and when I try to reload the plugin, this appears in the log:

Warning process (pid 82474) failed to quit after polite request -- forcing it to quit now
Stopped plugin "Email+ 2021.2.0"
Starting plugin "Email+ 2021.2.0" (pid 82763)
Started plugin "Email+ 2021.2.0"

Then, after a while this appears:

Gmail IMAP : Error connecting to KBF IMAP server: [Errno 60] Operation timed out
Email+ Error exception in deviceStartComm(KBF IMAP Server): [Errno 60] Operation timed out

Any ideas?

Posted on
Sun Dec 26, 2021 9:58 pm
FlyingDiver offline
User avatar
Posts: 7216
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: IMAP Server not working

Is the IMAP Email+ device named "GMail IMAP" or "KBF IMAP Server"?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Dec 26, 2021 11:26 pm
kennybroh offline
Posts: 531
Joined: Dec 13, 2009
Location: Baltimore

Re: IMAP Server not working

It’s the latter. I renamed it in the post.


Sent from my iPhone using Tapatalk

Posted on
Mon Dec 27, 2021 12:40 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: IMAP Server not working

FYI, Gmail's IMAP implementation is apparently very non-standard. I've not seen that particular error, but I've seen a lot of other IMAP errors (which the plugin will try to recover from). To the point that I don't use Gmail in my production system (I keep the Gmail account around for testing because it fails so often/oddly that it's useful for trying to add automatic recovery).

Can you turn on Detailed Debugging Messages in the plugin's config, then restart the plugin. Then when you get the errors again email us the log file and we'll try to figure out what's failing exactly.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Dec 27, 2021 6:04 pm
kennybroh offline
Posts: 531
Joined: Dec 13, 2009
Location: Baltimore

Re: IMAP Server not working

So, it now appears it is connecting to Gmail but the device still shows a "failure" status" and I'm not getting the results I'm looking for and it's still throwing off errors. I set up that Gmail account just to receive emails to trigger Indigo to do certain things. The specific example here, "Garage camera", is a trigger which is activated if the words "Garage camera" are found in the subject line, and the server turns on a bunch of lights. I sent an email to that account with "Garage camera" in the subject but the trigger was never activated and the email is still marked as unread.

Before I sent this I wanted to make sure I wasn't wasting your time, so I looked deeper into what I was doing and saw one odd thing in the trigger. One of the conditions was the value of "Last Message" for the IMAP server device was " ". I've looked everywhere for documentation of those states and found nothing. The choices are Last Message, and Message Subject, Text. From, To, Date. and xRegEx Match Result and Server Status. I think I understand most of them, but what is "Last Message"?

Anyway, I took that condition out, so the only condition to running the action is the brightness of "garage lights" is not 100. . Here's what the log reports beginning with a restart of the IMAP server. I left the real email server name in this time!

Dec 27, 2021 at 6:38:43 PM
Email+ Shutting down server 'KBF Indigo email'
Email+ Debug KBF Indigo email: Unknown Device ID: 1441975309
Email+ Starting mail device 'KBF Indigo email'
Email+ Debug KBF Indigo email: Device Version is up to date
Email+ Debug KBF Indigo email: Starting device (imapAccount)
Email+ Debug KBF Indigo email: Creating IMAP Server
Email+ Debug KBF Indigo email: Using IMAP IDLE
Email+ Debug KBF Indigo email: Doing connect using encryptionType = SSL

Dec 27, 2021 at 6:43:58 PM
Email+ Error KBF Indigo email: Error connecting to IMAP server: [Errno 60] Operation timed out
Email+ Debug connErrorTriggerCheck: Checking Triggers for Device KBF Indigo email (1441975309)
Email+ Debug Checking Trigger run good night (762850752), stringMatch
Email+ Debug Unknown Trigger Type run good night (762850752), stringMatch
Email+ Debug Checking Trigger Garage camera (1421841515), stringMatch
Email+ Debug Unknown Trigger Type Garage camera (1421841515), stringMatch
Email+ Error Error in plugin execution ServerReplacedElem:

Traceback (most recent call last):
File "/Library/Application Support/Perceptive Automation/Indigo 2021.2/IndigoPluginHost.app/Contents/Resources/PlugIns/plugin_base.py", line 1294, in deviceUpdated
File "plugin.py", line 261, in deviceStartComm
File "/Library/Application Support/Perceptive Automation/Indigo 2021.2/Plugins/Email+.indigoPlugin/Contents/Server Plugin/IMAPServer.py", line 36, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 2021.2/Plugins/Email+.indigoPlugin/Contents/Server Plugin/IMAPServer.py", line 120, in connectIMAP
File "/Library/Application Support/Perceptive Automation/Indigo 2021.2/Plugins/Email+.indigoPlugin/Contents/Server Plugin/imaplib2.py", line 2183, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 2021.2/Plugins/Email+.indigoPlugin/Contents/Server Plugin/imaplib2.py", line 361, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 2021.2/Plugins/Email+.indigoPlugin/Contents/Server Plugin/imaplib2.py", line 2195, in open
File "/Library/Application Support/Perceptive Automation/Indigo 2021.2/Plugins/Email+.indigoPlugin/Contents/Server Plugin/imaplib2.py", line 503, in open_socket
error: [Errno 60] Operation timed out

FYI, the SMTP server reports periodically that no email are in the queue and gives no errors.
Attachments
imap choices.jpeg
imap choices.jpeg (6.85 KiB) Viewed 2472 times

Posted on
Mon Dec 27, 2021 6:21 pm
FlyingDiver offline
User avatar
Posts: 7216
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: IMAP Server not working

It is NOT connecting to Gmail:

Code: Select all
Dec 27, 2021 at 6:43:58 PM
Email+ Error KBF Indigo email: Error connecting to IMAP server: [Errno 60] Operation timed out


So everything after that are errors caused by the IMAP device not actually operating.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Dec 27, 2021 6:23 pm
FlyingDiver offline
User avatar
Posts: 7216
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: IMAP Server not working

Also, when you successfully receive a message, the "Last Message" state will contain the MessageID of that email. It's a unique string generated by the originating email server.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Dec 27, 2021 6:24 pm
FlyingDiver offline
User avatar
Posts: 7216
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: IMAP Server not working

My recommendation is to use some other email service (iCloud, Outlook, GMX, etc) that has a more standard IMAP implementation than Gmail.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Dec 28, 2021 7:17 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: IMAP Server not working

In my experience, iCloud is not a great option. I have had trouble with Apple's spam filters killing the messages before they reached me--they didn't show up in my spam folder, they just didn't show up (well, they did sometimes, which is just as bad).

I settled on an email account with my ISP that has worked flawlessly. YMMV.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Dec 28, 2021 10:29 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: IMAP Server not working

FlyingDiver wrote:
My recommendation is to use some other email service (iCloud, Outlook, GMX, etc) that has a more standard IMAP implementation than Gmail.


+1

Based on the log, it appears that the plugin was never able to connect to Gmail's IMAP server (as you have it configured) for some reason. The timeout is a low-level socket error and means that when the library attempted to open the connection to the IMAP server some part of that communication never completed within the 5 minute timeout period. Validate that the settings you have in the IMAP device config are correct. You might also try turning off IMAP IDLE in the preferences, but I suspect that won't help.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Dec 28, 2021 10:40 am
kennybroh offline
Posts: 531
Joined: Dec 13, 2009
Location: Baltimore

Re: IMAP Server not working

Here's the configuration of the IMAP device.

Screen Shot 2021-12-28 at 11.33.56 AM.png
Screen Shot 2021-12-28 at 11.33.56 AM.png (122.89 KiB) Viewed 2417 times

Posted on
Tue Dec 28, 2021 10:51 am
kennybroh offline
Posts: 531
Joined: Dec 13, 2009
Location: Baltimore

Re: IMAP Server not working

I turned off IDLE. As Jay predicted, it didn't seem to help.:

Dec 28, 2021 at 11:41:03 AMDec 28, 2021 at 11:43:04 AM

Email+ Debug validateDeviceConfigUi
Email+ Debug KBF Indigo email: Unknown Device ID: 1441975309
Email+ Debug KBF Indigo email: Device Version is up to date
Email+ Debug KBF Indigo email: Starting device (imapAccount)
Email+ Debug KBF Indigo email: Creating IMAP Server


Dec 28, 2021 at 11:43:04 AM

Email+ Debug KBF Indigo email: Polling IMAP Server
Email+ Debug KBF Indigo email: Doing connect using encryptionType = SSL

Dec 28, 2021 at 11:45:15 AM

Email+ Error KBF Indigo email: Error connecting to IMAP server: [Errno 60] Operation timed out
Email+ Debug connErrorTriggerCheck: Checking Triggers for Device KBF Indigo email (1441975309)
Email+ Debug Checking Trigger run good night (762850752), stringMatch
Email+ Debug Unknown Trigger Type run good night (762850752), stringMatch
Email+ Debug Checking Trigger Garage camera (1421841515), stringMatch
Email+ Debug Unknown Trigger Type Garage camera (1421841515), stringMatch
Email+ Error KBF Indigo email: IMAP server connection error: [Errno 60] Operation timed out
Email+ Debug Email+ SMTP Server: SMTP poll, 0 items in queue
Email+ Debug KBF Indigo email: Polling IMAP Server
Email+ Debug KBF Indigo email: Doing connect using encryptionType = SSL

Posted on
Tue Dec 28, 2021 11:07 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: IMAP Server not working

Did you confirm that those are the correct settings (as specified by Google)? Apparently, you also have to specifically turn on IMAP on your gmail account though I don't know exactly how to do that...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Dec 28, 2021 1:39 pm
kennybroh offline
Posts: 531
Joined: Dec 13, 2009
Location: Baltimore

Re: IMAP Server not working

I really am not usually a moron. I had checked and double checked all this. Yes, I turned it on in Gmail but somehow the port number was wrong==should have been 993, not 994.

While that at least enabled the connection, it got me back to the same problem I had when I set the device up as a POP server, which is why I changed to IMAP in the first place. I started getting this error again:

Email+ Error KBF Indigo email: Error connecting to IMAP server: [AUTHENTICATIONFAILED] Invalid credentials (Failure)

Just to be sure I had the right credentials, I logged in manually to this Gmail account in the browser and then re-entered the password that got me into Gmail on my computer. Still got the error.

There is an online link to clear any Captcha authentication requirement which I did but that didn't help. This is the link if anyone is interested: https://accounts.google.com/DisplayUnlockCaptcha

Finally I saw a reference somewhere to enabling less secure apps. Once I enabled that in Gmail guess what... it worked! The device now shows success. I deleted all the email in that mailbox and sent a new one and Indigo saw it, checked the triggers and deleted it. , But what a pain.

My understanding is IDLE opens a connection and eliminates the need to poll so I turned that back on. Email+ was silent in the log until I sent a new message, and it saw it immediately and processed it correctly. Just as a last test, I changed the parameters of the trigger to fire in the daytime and turn off a light next to me. Worked like a charm.

The only thing what was not perfect was this. I have to give a little intro, however. I'm accessing the Mini via Screen Share and there is a really irritating bug the affects M-1 machines where the screensaver comes on and you cannot turn it off. Clickthis link to read more about it: https://www.cultofmac.com/732846/avoid-m1-mac-screensaver-bug/ I found a way to work around it--if you close and re-open the screen share, the login screen appears. Don't log in, because that will just get you to the screensaver. Instead tell the Mac to Sleep and then press a key and the screensaver is gone.

Why am I tellng you this? Because the first test email I sent with the changed trigger came in just before the machine went to sleep and when it woke up that email wasn't processed. Then I sent a second one, and Email+ picked it up instantly but only deleted that one, leaving the first one in the Inbox. SO, I just turned on process all emails and that got rid of it. Since I'm only using this mailbox for this purpose that probably makes sense.

Anyway, thanks for your help. A really irritating process of getting past all these roadblocks.

Posted on
Tue Dec 28, 2021 3:39 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: IMAP Server not working

I think you can also generate an app specific password (don't ask me how) so you don't have to enable that "less secure" setting, which I suspect will go away some day.

I can almost guarantee that you're going to get IDLE errors periodically, something about log out or some such. Their IMAP implementation sucks, and their IDLE support is even worse. I've had a couple of instances where it could never recover from those errors and I had to disable the IMAP server device for a while (like an hour I think) before it would start working again. Just warning you up front that there are other Gmail IMAP issues that you'll likely see.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Who is online

Users browsing this forum: No registered users and 2 guests