Support for Imap Idle in Ruby

Specified SASL mechanism not supported net/imap ruby

I used imap.login in place of imap.authenticate.
It worked like a charm.

imap.login('user', 'passwd')

Net::IMAP fails: Connection Closed

Port 993 is usually the way t connect via SSL IMAP so you need to tell ruby you need to connect via SSL such as:

imap = Net::IMAP.new('outlook.office365.com', 993, ssl: true)

Then you can use login or authenticate to connect to your user's mailbox.

The ruby doc state that if you use authenticate method, you need to make sure the imap server can support "LOGIN" or "CRAM-MD5" but in the list you provided i don't see any of those.

["IMAP4", "IMAP4REV1", "AUTH=PLAIN", "AUTH=XOAUTH2", "SASL-IR", "UIDPLUS", "ID", "UNSELECT", "CHILDREN", "IDLE", "NAMESPACE", "LITERAL+"]

So the only way to login to outlook imap is to use map.login method such as:
imap.login(login, password)

When to use Noop command to keep alive imap idle connection

Strictly, you do not need NOOP when using IDLE. When in IDLE, the only command you can execute is DONE. You can then immediately go back into a new IDLE.

According to the specification, you must reissue IDLE at least every 29 minutes, as the server is allowed to close connection after 30 minutes. However, if you are behind a NAT (especially on cellular networks), you may need to do it more often to keep the socket mapping alive.



Related Topics



Leave a reply



Submit