Command Line

Mailer’s command-line interface is used to run the Mailer application, and to manage system services. There is help text available for each command that can be accessed using the -help flag.

mailer.exe -help
usage: mailer.exe <command> [<args>]

Available Commands:
    server    Run the main Mailer application
    version   Print the version number and exit
    service   Install, uninstall, and control Mailer system services

For help with any command, use the help option:
mailer.exe <command> -help

Commands

Mailer has several sub-commands that are documented here. Again, each one has help text available with the -help flag.

Server

The server command runs Mailer in the foreground. No configuration file is required, but if a config.yml or config.yaml file is present in your working directory, it will be loaded automatically. If no configuration file is loaded, the defaults will be assumed. All of the defaults are shown in the example configuration file.

Usage of server:
  -config string
        the path to your configuration file

Example: running Mailer with a custom configuration file

mailer.exe server -config custom.yaml

Service

The service command is used to install, uninstall, start, stop, restart, and check the status of Mailer system services.

usage: mailer.exe service <command> [<args>]

Available Commands:
    install   Install a new Mailer service
    uninstall Uninstall an existing Mailer service
    start     Start an existing Mailer service
    stop      Stop an existing Mailer service
    restart   Restart an existing Mailer service
    status    Print the current status of a Mailer service

For help with any command, use the help option:
mailer.exe service <command> -help

Install

To install a new Mailer service, use the install command. The installed service will use the Mailer installation directory as its working directory by default, but you can specify a different directory with the -work-dir flag if necessary. If you install a service using a custom service ID (the -id flag), you must use that same ID to interact with the service using any of the other service sub-commands.

Usage of service:
  -config string
        the path to your configuration file
  -id string
        specify the id of the service to manage (default "mdi-mailer")
  -name string
        the name you want to display in the service manager (default "MDI Mailer")
  -work-dir string
        the working directory the service will run in (default "C:\\Users\\chrisb.MGTDATA\\workspace\\mailer\\mailer")

Example: simplest installation

mailer.exe service install

Example: installing multiple services with different configurations

mailer.exe service install -id mailer1 -config config1.yaml
mailer.exe service install -id mailer2 -config config2.yaml

Uninstall

To uninstall a previously installed Mailer service, use the uninstall command.

Usage of service:
  -id string
        specify the id of the service to manage (default "mdi-mailer")

Example: simplest uninstall

mailer.exe service uninstall

Example: if you used a custom service ID

mailer.exe service uninstall -id mailer1

Start

To start an existing Mailer service, use the start command.

Usage of service:
  -id string
        specify the id of the service to manage (default "mdi-mailer")

Example: simple

mailer.exe service start

Example: if you used a custom service ID

mailer.exe service start -id mailer1

Stop

To stop an existing Mailer service, use the stop command.

Usage of service:
  -id string
        specify the id of the service to manage (default "mdi-mailer")

Example: simple

mailer.exe service stop

Example: if you used a custom service ID

mailer.exe service stop -id mailer1

Restart

To restart an existing Mailer service, use the restart command.

Usage of service:
  -id string
        specify the id of the service to manage (default "mdi-mailer")

Example: simple

mailer.exe service restart

Example: if you used a custom service ID

mailer.exe service restart -id mailer1

Status

To check the status of an installed Mailer service, use the status command.

Usage of service:
  -id string
        specify the id of the service to manage (default "mdi-mailer")

Example: simple

mailer.exe service status

Example: if you used a custom service ID

mailer.exe service status -id mailer1

Version

The version command prints the Mailer version to your console and exits.

Usage of version:
  -verbose
        print verbose version info