Class: At_email::Account::ImapConnection

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeImapConnection

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

#imapObject (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

#disconnectObject



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

#loginObject



21
22
23
24
# File 'lib/at_email/account/connection.rb', line 21

def 
  $logger.info 'Logging into IMAP server - Username: ' + $config[:username]
  @imap.($config[:username], $config[:password])
end