Module: OnlyofficeIredmailHelper::MailboxesMethods
- Included in:
- IredMailHelper
- Defined in:
- lib/onlyoffice_iredmail_helper/mailboxes_methods.rb
Overview
Methods for working with Mail account Mailboxes
Instance Method Summary collapse
-
#create_mailbox(name) ⇒ nil
Create new mailbox with name.
-
#delete_mailbox(name) ⇒ nil
Delete mailbox with name.
-
#mailboxes ⇒ Array<String>
List of folder names.
Instance Method Details
#create_mailbox(name) ⇒ nil
Create new mailbox with name
19 20 21 22 23 24 25 |
# File 'lib/onlyoffice_iredmail_helper/mailboxes_methods.rb', line 19 def create_mailbox(name) login @imap.select('INBOX') @imap.create(name) close OnlyofficeLoggerHelper.log("Created new mailbox: #{name}") end |
#delete_mailbox(name) ⇒ nil
Delete mailbox with name
30 31 32 33 34 35 36 37 38 |
# File 'lib/onlyoffice_iredmail_helper/mailboxes_methods.rb', line 30 def delete_mailbox(name) raise("There is no mailbox #{name} to delete") unless mailboxes.include?(name) login @imap.select('INBOX') @imap.delete(name) close OnlyofficeLoggerHelper.log("Delete mailbox by name: #{name}") end |
#mailboxes ⇒ Array<String>
Returns list of folder names.
7 8 9 10 11 12 13 14 |
# File 'lib/onlyoffice_iredmail_helper/mailboxes_methods.rb', line 7 def mailboxes login @imap.select('INBOX') folders = @imap.list('%', '%').map(&:name) close OnlyofficeLoggerHelper.log("Get list of mailboxes: #{folders}") folders end |