Extends Ruby's URI with support for IMAP-uri's.
Install the gem and add to the application's Gemfile by executing:
bundle add uri-imapIf bundler is not being used to manage dependencies, install the gem by executing:
gem install uri-imapu = URI("imaps+plain://user%40gmail.com:p%40ss@imap.gmail.com")
url.scheme #=> "imaps+plain"
url.auth #=> "plain"
url.starttls #=> false
url.starttls? #=> false
url.tls? #=> true
url.userinfo #=> "user%40gmail.com:p%40ss"
url.decoded_userinfo #=> "user@gmail.com:p@ss"
url.decoded_user #=> "user@gmail.com"
url.user #=> "user%40gmail.com"
url.decoded_password #=> "p@ss"
url.password #=> "p%40ss"
url.host #=> "imap.gmail.com"
url.port #=> 993URI("imaps+login://user%40gmail.com:p%40ss@imap.gmail.com").to_h
#=>
{auth: "login",
host: "imap.gmail.com",
port: 993,
scheme: "imaps+login",
starttls: false,
tls: true,
user: "user@gmail.com",
password: "p@ss"}There's no official specification for IMAP-URIs. There's some prior work though. This implementation is heavily inspired by aerc.
<scheme>[+<auth>]://[<user>[:<password>]@]<host>[:<port>][?<query>]
imap
IMAP with STARTTLS (i.e.url.starttls #=> :always).imap+insecure
IMAP without STARTTLS (i.e.url.starttls #=> false)..imaps
IMAP with TLS.
Any value for auth that passes the URI-parser is acceptable. Though the following values have special meaning:
none
No authentication is required.plain
Authenticate with a username and password using AUTH PLAIN. This is the default behavior when no authentication is provided.
Note
any query's value for auth takes precedence.
TBD
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
Use bin/yard server --reload when working on documentation.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/eval/uri-imap.
The gem is available as open source under the terms of the MIT License.