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
Convert an Array of Integers into an Array of Strings in Ruby
Simple Cropping with Paperclip
Rails. How to Store Time of Day (For Schedule)
(Ruby,Rails) Context of Self in Modules and Libraries...
Rails 6.1, Ruby 3.0.0: Tests Error as They Cannot Load Rexml
What Is the Modern Way to Structure a Ruby Gem
Put Haml Tags Inside Link_To Helper
Can Bundler Show Me Which Gems in Gemfile Have Newer Versions (Eg. Dry-Run of Bundle Update)
Rails 3:How to Generate Models for Existing Database Tables
Rails3 Devise Undefined Method 'Confirmation_Url'
Changing Field Separator/Delimiter in Exported CSV Using Ruby CSV
Safely Assign Value to Nested Hash Using Hash#Dig or Lonely Operator(&.)
Ruby Bundler Multiple Sources in Gemfile
Converting Utf8 to Ansi with Ruby
Ruby Open-Uri Redirect Forbidden