Skip to main content

Email

Getting a list of email domains

Command

mogwai emails domains list

Example output

ID      NAME            FALLBACK        DKIM    ENABLED OWNER_ID        OWNER           CREATE_AT
1 example.com true true 1 example_com_usr 2024-01-04 15:46:02+03:00

The domains IDs is used in other commands.

Adding an email domain

Command

mogwai emails domains create

Options

  • --domain=DOMAIN : Email domain name.
  • -o, --owner="fastuser" : The FASTPANEL user to which the email domain will be added.

Example of creating an email domain example1.com under the fastuser user

mogwai emails domains create --domain=example1.com -o fastuser

Getting a list of mailboxes

Command

mogwai emails boxes list

Options

  • --domain=DOMAIN : Mail domain name

Example command

mogwai emails boxes list --domain example.com

Example output

ID      ADDRESS                 ALIASES REDIRECTS       SIZE    QUOTA   ENABLED OWNER_ID        OWNER           CREATE_AT
1 [email protected] 0 0 true 4 example_com_usr 2024-02-08 11:13:01+03:00

The ID from the command output is used in other commands.

Creating a mailbox

Command

mogwai emails boxes create

Options

  • --domain=DOMAIN : Email domain name.
  • -l, --login=LOGIN : The name of the mailbox, without the domain.
  • -p, --password=PASSWORD : The password for the mailbox.

Example command

mogwai emails boxes create  --domain=example.com --login=user --password=MySecretPassword123

This command will create a mailbox named [email protected] with the password MySecretPassword123.

Deleting a mailbox

Command

mogwai emails boxes delete

Options

  • -b, --box=BOX : The ID of the mailbox..

Example command

mogwai emails boxes delete -b 1

This command will delete the mailbox with the ID of 1.

Importing mailboxes and emails

Command

mogwai emails boxes import[sync] [<flags>]

Options

  • -i, --import_config=IMPORT_CONFIG : Path to the import list file
  • --force : Only for import mode - clear existing mailboxes.

To import mail, you need to prepare a list of mailboxes on the server in the format:

IMAP_HOST;SOURCE_ADDR;SOURCE_PASSWORD;DEST_ADDR

Options

  • IMAP_HOST : Address of the IMAP mail server.
  • SOURCE_ADDR : Mailbox on the source server.
  • SOURCE_PASSWORD : Password for IMAP connection to the mailbox on the source server. Some services, such as Google, require creating an application password for IMAP access https://support.google.com/accounts/answer/185833?hl=en
  • DEST_ADDR : Mailbox on the FASTPANEL server to which messages are transferred.

Example file content

imap.gmail.com;[email protected];password;[email protected]
imap.gmail.com;[email protected];password;[email protected]

Two modes are available:

Import mode

mogwai emails boxes import

In this mode, all messages are copied in full, mailboxes on the FASTPANEL server must not be created or empty - when the command is executed, FASTPANEL creates the necessary mailboxes. If mailboxes with content already exist, an error will be displayed. You can use the --force flag - then the mailbox will be cleared.

Example of running the command with a list of mailboxes stored in the /root/import.txt file and using the --force key

mogwai emails boxes import --import_config=/root/import.txt --force

Sync mode

mogwai emails boxes sync

In this mode, the Control Panel downloads messages from the source server without deleting anything. It should be used if new messages have appeared in the original mailbox after the first import, which also need to be transferred.

Example command

mogwai emails boxes sync --import_config=/root/import.txt