devel
This commit is contained in:
parent
f81c1d69c5
commit
37f548ce46
89 changed files with 466 additions and 70 deletions
21
lib/imap_session.rb
Executable file
21
lib/imap_session.rb
Executable file
|
@ -0,0 +1,21 @@
|
|||
require 'net/imap'
|
||||
require 'imap_mailbox'
|
||||
|
||||
module ImapSessionModule
|
||||
|
||||
def open_imap_session
|
||||
begin
|
||||
@mailbox = ImapMailboxModule::IMAPMailbox.new(logger)
|
||||
@mailbox.connect(@current_user.servers.primary,@current_user.email, @current_user.get_cached_password(session))
|
||||
rescue Exception => ex
|
||||
redirect_to :controller => 'internal', :action => 'imaperror' , :error => ex.inspect
|
||||
end
|
||||
end
|
||||
|
||||
def close_imap_session
|
||||
return if @mailbox.nil? or not(@mailbox.connected)
|
||||
@mailbox.disconnect
|
||||
@mailbox = nil
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue