You can try creating a log file to see if it shows something that may help you find the cause of the issue.
This is the log:
==== Logging started ====
07/08-2017 22:19:58 IMAP#1/1: Connecting...
07/08-2017 22:20:01 IMAP#1/1 IN {}: * OK [CAPABILITY IMAP4rev1 ID MOVE NAMESPACE X-ID-ACLID UIDPLUS LITERAL+ XYMHIGHESTMODSEQ AUTH=plain SASL-IR AUTH=PLAIN AUTH=LOGIN AUTH=XYMLOGIN AUTH=XYMPKI AUTH=XYMCOOKIEB64 AUTH=XOAUTH2 AUTH=OAUTHBEARER] IMAP4rev1 Hello
07/08-2017 22:20:01 IMAP#1/1 OUT {}: 0000 ID ("name" "Opera Mail" "version" "1.0" "vendor" "Opera Software ASA" "os" "Win32")
07/08-2017 22:20:01 IMAP#1/1 IN {}: * ID ("remote-host" "2.40.184.37" "vendor" "Yahoo! Inc." "support-url" "http://help.yahoo.com/" "name" "Y!IMAP" "host" "sky700102.imap.mail.yahoo.com" "version" "1.1.10284")
07/08-2017 22:20:01 IMAP#1/1 IN {}: 0000 OK ID completed
07/08-2017 22:20:01 IMAP#1/1 OUT {}: [command contains password]
07/08-2017 22:20:01 IMAP#1/1 IN {}: +
07/08-2017 22:20:01 IMAP#1/1 OUT {}: [command contains password]
07/08-2017 22:20:01 IMAP#1/1 IN {}: + eyJzdGF0dXMiOiJpbnZhbGlkX2NyZWRlbnRpYWxzIiwic2NoZW1lIjoiYmFzaWMiLCJzY29wZSI6Imh0dHBzOi8vbWFpbC55YWhvby5jb20vIn0=
07/08-2017 22:20:01 IMAP#1/1 OUT {}: [command contains password]
07/08-2017 22:20:01 IMAP#1/1 IN {}: 0001 BAD [AUTHENTICATIONFAILED] AUTHENTICATE Invalid credentials
07/08-2017 22:20:01 IMAP#1/1: Disconnected: Received disconnect order
07/08-2017 22:20:05 IMAP#1/1: Connecting...
07/08-2017 22:20:05 IMAP#1/1 IN {}: * OK [CAPABILITY IMAP4rev1 ID MOVE NAMESPACE X-ID-ACLID UIDPLUS LITERAL+ XYMHIGHESTMODSEQ AUTH=plain SASL-IR AUTH=PLAIN AUTH=LOGIN AUTH=XYMLOGIN AUTH=XYMPKI AUTH=XYMCOOKIEB64 AUTH=XOAUTH2 AUTH=OAUTHBEARER] IMAP4rev1 Hello
07/08-2017 22:20:05 IMAP#1/1 OUT {}: 0002 ID ("name" "Opera Mail" "version" "1.0" "vendor" "Opera Software ASA" "os" "Win32")
07/08-2017 22:20:05 IMAP#1/1 IN {}: * ID ("remote-host" "2.40.184.37" "vendor" "Yahoo! Inc." "support-url" "http://help.yahoo.com/" "name" "Y!IMAP" "host" "sky700125.imap.mail.yahoo.com" "version" "1.1.10284")
07/08-2017 22:20:05 IMAP#1/1 IN {}: 0002 OK ID completed
07/08-2017 22:20:05 IMAP#1/1 OUT {}: [command contains password]
07/08-2017 22:20:05 IMAP#1/1 IN {}: +
07/08-2017 22:20:05 IMAP#1/1 OUT {}: [command contains password]
07/08-2017 22:20:05 IMAP#1/1 IN {}: + eyJzdGF0dXMiOiJpbnZhbGlkX2NyZWRlbnRpYWxzIiwic2NoZW1lIjoiYmFzaWMiLCJzY29wZSI6Imh0dHBzOi8vbWFpbC55YWhvby5jb20vIn0=
07/08-2017 22:20:05 IMAP#1/1 OUT {}: [command contains password]
07/08-2017 22:20:06 IMAP#1/1 IN {}: 0003 BAD [AUTHENTICATIONFAILED] AUTHENTICATE Invalid credentials
07/08-2017 22:20:06 IMAP#1/1: Disconnected: Received disconnect order