Skip to content

MailOS Env Command

The mailos env command shows and manages MailOS environment variables and project send defaults.

Use it when you need to verify what mailos send will see from the current directory, including values resolved from a parent emailos.json or emailos.toml.

To select a repository-specific global account config through direnv, export MAILOS_CONFIG_PATH:

bash
# .envrc
export MAILOS_CONFIG_PATH="$PWD/.private/emailos-config.json"

MAILOS_CONFIG_PATH controls the account config normally loaded from ~/.email/config.json. It is separate from emailos.toml, which stores commit-safe project send defaults such as from_address, from_name, and signature.

Basic Usage

bash
mailos env

To apply a saved global project profile to the current folder:

bash
mailos env work

This copies ~/.email/configs/work.toml to ./emailos.toml and adds emailos.toml to the current repository's local .git/info/exclude.

The output includes:

  • resolved non-secret MailOS send variables
  • the nearest parent emailos.json or emailos.toml path when one is found
  • the source of MAILOS_FROM_EMAIL
  • a reminder that MAILOS_FROM_EMAIL controls the outgoing From address and --account selects credentials

Project Config Profiles

Project config profiles are reusable TOML send defaults stored on the user's machine under ~/.email/configs.

Save the nearest project config as a global profile:

bash
mailos env --save-profile work

List saved profiles and their resolved sender values:

bash
mailos env list

Apply a profile to the current folder:

bash
mailos env work

Applying a profile writes ./emailos.toml. By default MailOS adds emailos.toml to the current repository's local .git/info/exclude, so the generated folder-specific config does not show up in code review or git status. Pass --no-exclude when you intentionally want Git to see the file.

If ./emailos.json exists, MailOS refuses to apply the profile because JSON takes precedence over TOML in the same folder.

Flags

FlagTypeDescriptionExample
--set-emailstringSet MAILOS_EMAIL_ADDRESS in local ./.envmailos env --set-email [email protected]
--set-from-emailstringSet MAILOS_FROM_EMAIL in local ./.envmailos env --set-from-email [email protected]
--set-signaturestringSet MAILOS_SIGNATURE in local ./.envmailos env --set-signature "Regards"
--set-passwordstringSet MAILOS_APP_PASSWORD in local ./.envmailos env --set-password app-password
--set-licensestringSet MAILOS_LICENSE_KEY in local ./.envmailos env --set-license license-key
--set-picturestringSet MAILOS_PICTURE in local ./.envmailos env --set-picture /path/to/me.jpg
--show-localboolShow local ./.env contentsmailos env --show-local
--show-globalboolShow global ~/.email/.env contentsmailos env --show-global
--edit-localboolPrint commands for editing local ./.envmailos env --edit-local
--edit-globalboolPrint commands for editing global ~/.email/.envmailos env --edit-global
--listboolList resolved MailOS environment variablesmailos env --list
--exportboolPrint resolved non-secret send values as shell exportsmailos env --export
--save-profilestringSave nearest project config as ~/.email/configs/<name>.tomlmailos env --save-profile work
--list-profilesboolList global project config profilesmailos env list
--no-excludeboolDo not add generated emailos.toml to local .git/info/excludemailos env work --no-exclude

Resolution Sources

For send diagnostics, MailOS combines:

  1. existing exported environment variables
  2. local ./.env.mailos
  3. local ./.env
  4. nearest parent emailos.json or emailos.toml
  5. global ~/.email/.env

Most file-based values only fill unset variables, so already-exported values normally win. from_address in project config is the exception: it deliberately controls the outgoing sender for that project and becomes MAILOS_FROM_EMAIL.

Export for AI Clients

Some AI clients, shell wrappers, and IDE integrations only inspect real environment variables with commands such as printenv. They will not see values that MailOS resolves from a parent project config unless you export them first.

From the project folder, run:

bash
eval "$(mailos env --export)"

Then tools in that shell can see values such as:

bash
printenv MAILOS_FROM_EMAIL

mailos env --export emits shell-safe exports for non-secret send values only:

bash
export MAILOS_EMAIL_ADDRESS='[email protected]'
export MAILOS_FROM_EMAIL='[email protected]'
export MAILOS_FROM_NAME='Sender Name'

It does not emit secrets such as MAILOS_APP_PASSWORD, MAILOS_LICENSE_KEY, or account-specific password variables.

Use mailos whoami or mailos config --values for a compact source report:

bash
mailos whoami
mailos config --values

Use mailos send --dry-run --verbose to verify the final From, signature, media, and recipients before sending.

Released under the MIT License.