Class: At_email::Account::ImapConnection
- Inherits:
-
Object
- Object
- At_email::Account::ImapConnection
- Defined in:
- lib/at_email/account/connection.rb
Constant Summary collapse
- METADATA_ATTRIBUTES =
[ 'ENVELOPE', 'FLAGS' ].freeze
- REQUESTED_ATTRIBUTES =
[ 'INTERNALDATE', 'RFC822', 'RFC822.SIZE' ].freeze
Instance Attribute Summary collapse
-
#imap ⇒ Object
readonly
Returns the value of attribute imap.
Instance Method Summary collapse
- #disconnect ⇒ Object
-
#initialize ⇒ ImapConnection
constructor
A new instance of ImapConnection.
- #login ⇒ Object
Constructor Details
#initialize ⇒ ImapConnection
Returns a new instance of ImapConnection.
15 16 17 18 19 |
# File 'lib/at_email/account/connection.rb', line 15 def initialize() $logger.info 'Connecting to IMAP server - Host: ' + $config[:server] + ' - Port: ' + $config[:port].to_s connect_config = {port: $config[:port], ssl: $config[:ssl]} @imap = At_email::Account::Imap.new($config[:server], connect_config) end |
Instance Attribute Details
#imap ⇒ Object (readonly)
Returns the value of attribute imap.
10 11 12 |
# File 'lib/at_email/account/connection.rb', line 10 def imap @imap end |
Instance Method Details
#disconnect ⇒ Object
26 27 28 29 30 |
# File 'lib/at_email/account/connection.rb', line 26 def disconnect $logger.debug 'Logging out from IMAP server' @imap.logout @imap.disconnect end |
#login ⇒ Object
21 22 23 24 |
# File 'lib/at_email/account/connection.rb', line 21 def login $logger.info 'Logging into IMAP server - Username: ' + $config[:username] @imap.login($config[:username], $config[:password]) end |