Module: Teamlab::MailserverMailboxes

Included in:
MailServer
Defined in:
lib/teamlab/modules/mailserver/mailboxes.rb

Overview

Methods for working with mailserver mailboxes

Instance Method Summary collapse

Instance Method Details

#add_mailbox(name: nil, local_part: nil, domain_id: nil, user_id: nil, notify_current: true, notify_profile: true) ⇒ Hash

Returns Add mailbox.

Parameters:

  • name (String) (defaults to: nil)

    name of mailbox

  • local_part (String) (defaults to: nil)

    local part of mailbox

  • domain_id (Integer) (defaults to: nil)

    id of domain

  • user_id (Integer) (defaults to: nil)

    id of user

  • notify_current (True, False) (defaults to: true)

    Send message to creating mailbox’s address

  • notify_profile (True, False) (defaults to: true)

    Send message to email from user profile

Returns:

  • (Hash)

    Add mailbox



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/teamlab/modules/mailserver/mailboxes.rb', line 13

def add_mailbox(name: nil,
                local_part: nil,
                domain_id: nil,
                user_id: nil,
                notify_current: true,
                notify_profile: true)
  @request.post(%w[mailboxes add],
                name: name,
                local_part: local_part,
                domain_id: domain_id,
                user_id: user_id,
                notifyCurrent: notify_current,
                notifyProfile: notify_profile)
end

#delete_mailbox(id) ⇒ Hash

Deletes the selected mailbox

Parameters:

  • id (Integer)

    id of mailbox

Returns:

  • (Hash)

    result of mailbox deletion



36
37
38
# File 'lib/teamlab/modules/mailserver/mailboxes.rb', line 36

def delete_mailbox(id)
  @request.delete(['mailboxes', 'remove', id.to_s])
end

#mailboxesHash

Returns mailboxes list.

Returns:

  • (Hash)

    mailboxes list



29
30
31
# File 'lib/teamlab/modules/mailserver/mailboxes.rb', line 29

def mailboxes
  @request.get(%w[mailboxes get])
end