URI::IMAP

Extends Ruby's URI
with support for IMAP-uri's.
Installation
Install the gem and add to the application's Gemfile by executing:
bundle add uri-imap
If bundler is not being used to manage dependencies, install the gem by executing:
gem install uri-imap
Usage
parse
u = 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 #=> 993
to_h
URI("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"}
IMAP-URI
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>]
scheme
imap
IMAP with STARTTLS (i.e.url.starttls #=> :always
).imap+insecure
IMAP without STARTTLS (i.e.url.starttls #=> false
)..imaps
IMAP with TLS.
auth
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.
Examples
TBD
Development
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.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/eval/uri-imap.
License
The gem is available as open source under the terms of the MIT License.