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:
# .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
mailos envTo apply a saved global project profile to the current folder:
mailos env workThis 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.jsonoremailos.tomlpath when one is found - the source of
MAILOS_FROM_EMAIL - a reminder that
MAILOS_FROM_EMAILcontrols the outgoingFromaddress and--accountselects 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:
mailos env --save-profile workList saved profiles and their resolved sender values:
mailos env listApply a profile to the current folder:
mailos env workApplying 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
| Flag | Type | Description | Example |
|---|---|---|---|
--set-email | string | Set MAILOS_EMAIL_ADDRESS in local ./.env | mailos env --set-email [email protected] |
--set-from-email | string | Set MAILOS_FROM_EMAIL in local ./.env | mailos env --set-from-email [email protected] |
--set-signature | string | Set MAILOS_SIGNATURE in local ./.env | mailos env --set-signature "Regards" |
--set-password | string | Set MAILOS_APP_PASSWORD in local ./.env | mailos env --set-password app-password |
--set-license | string | Set MAILOS_LICENSE_KEY in local ./.env | mailos env --set-license license-key |
--set-picture | string | Set MAILOS_PICTURE in local ./.env | mailos env --set-picture /path/to/me.jpg |
--show-local | bool | Show local ./.env contents | mailos env --show-local |
--show-global | bool | Show global ~/.email/.env contents | mailos env --show-global |
--edit-local | bool | Print commands for editing local ./.env | mailos env --edit-local |
--edit-global | bool | Print commands for editing global ~/.email/.env | mailos env --edit-global |
--list | bool | List resolved MailOS environment variables | mailos env --list |
--export | bool | Print resolved non-secret send values as shell exports | mailos env --export |
--save-profile | string | Save nearest project config as ~/.email/configs/<name>.toml | mailos env --save-profile work |
--list-profiles | bool | List global project config profiles | mailos env list |
--no-exclude | bool | Do not add generated emailos.toml to local .git/info/exclude | mailos env work --no-exclude |
Resolution Sources
For send diagnostics, MailOS combines:
- existing exported environment variables
- local
./.env.mailos - local
./.env - nearest parent
emailos.jsonoremailos.toml - 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:
eval "$(mailos env --export)"Then tools in that shell can see values such as:
printenv MAILOS_FROM_EMAILmailos env --export emits shell-safe exports for non-secret send values only:
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.
Related Commands
Use mailos whoami or mailos config --values for a compact source report:
mailos whoami
mailos config --valuesUse mailos send --dry-run --verbose to verify the final From, signature, media, and recipients before sending.
