Skip to main content

Send Mail Via Python (smvp)

PyPI version Python versions License Status


smvp logo

The smvp utility reads a file, uses its contents as the body of an email, and sends it to a specified recipient. The input file can be a text file with ANSI color codes, HTML, or plain text. The resulting message is sent as a multipart MIME email that renders properly in both plain text and HTML. The --content-type option can auto-detect the input type or force it to be handled as plain text or HTML.

Note: The file itself is not sent as an attachment; instead, the contents of the file are put into the body of the email.

Compatibility

The smvp runtime requires Python 3.11 or newer and is supported on Windows, Linux, and macOS.

Local project tooling supports Linux and macOS. The GitHub release workflow runs on Linux; the cron examples below are Linux-specific.

Use Case

There are several use cases, but smvp was developed for two primary purposes:

  1. Configuring postfix and sendmail can require more setup than a small script needs.
  2. Cron scripts often need to email status information and the contents of various log files. Some of the files contain ANSI escape sequences for terminal colors. The smvp utility converts those ANSI escape sequences into styled HTML, so the resulting emails are nicely formatted. You could set $MAILTO in your crontab, but you would not get proper handling of ANSI escape sequences, and you would still have the problem mentioned in item 1.

Installation

Use your preferred Python package installer for command line tools, for example:

pipx install smvp

or

uv tool install smvp

or

python -m venv .venv

# Linux / macOS
source .venv/bin/activate

# Windows PowerShell
.venv\Scripts\Activate.ps1

# Windows Command Prompt
.venv\Scripts\activate.bat

python -m pip install smvp

Requirements

SMTP Environment Variables

Set the following environment variables in the shell you are using before running smvp.

Linux / macOS shells:

export SMVP_USER="<your email>"    # e.g. "myemail@gmail.com"
export SMVP_TOKEN="<your token>"   # e.g. "<gmail app password>"
export SMVP_SERVER="<smtp server>" # e.g. "smtp.gmail.com"

Windows PowerShell:

$env:SMVP_USER = "<your email>"
$env:SMVP_TOKEN = "<your token>"
$env:SMVP_SERVER = "<smtp server>"

Windows Command Prompt:

set SMVP_USER=<your email>
set SMVP_TOKEN=<your token>
set SMVP_SERVER=<smtp server>

If you want these variables to persist across sessions, add them to your shell profile or your Windows user environment settings.


Linux automation note:

Tip: If you're using cron and sending mail with smvp from within a script, make sure to include the environment variables at the top of your crontab so your scripts will have access to them during execution. Also include a line in your script that exports the directory where your Python tool installer places executables. For example, if you're using uv on Ubuntu, you could put something like this near the top of your bash script:

# Setup PATH export so the script can find installed Python tools
export PATH="$PATH:/home/<yourhome>/.local/bin"

SMTP Server

The SMVP_SERVER you select must support secure TLS connections on port 587. Check the SMTP settings for your email provider. This is the default TLS port on Gmail, so if you are using your Gmail account to send email, this requirement is usually already satisfied.

Styling

smvp offers custom font and font size options for your email. The default font for formatted HTML email is Courier New, 12px. Beyond the default, you can choose any font size from 2px up to and including 100px, from the following font families:

"Andale Mono", "Arial", "Brush Script MT", "Comic Sans MS",
"Courier New", "Garamond", "Georgia", "Helvetica", "Impact",
"Luminari", "Monaco", "Tahoma", "Times New Roman", "Trebuchet MS",
"Verdana", "fantasy", "monospace", "sans-serif", "serif"

Note: Not every font will render properly on every device. When in doubt, fonts such as "monospace", "sans-serif", "fantasy", and "serif" are generally safe. You may need to try a few options to find the right one for your use case.

Content Type

By default, smvp uses --content-type auto, which inspects the input and decides whether to treat it as plain text or HTML. You can override that behavior when needed:

auto  Auto-detect whether the input should be treated as text or HTML
text  Always treat the input as plain text, including HTML-like content
html  Always treat the input as HTML

This is useful when the input contains angle brackets that should be sent literally, or when you want to force HTML rendering for a file that would not otherwise be detected as HTML.

Usage

usage: smvp [-h] [-c {auto,text,html}] [-f FONT_FAMILY] [-s FONT_SIZE] [-v] recipient subject file

For example:

smvp friend@gmail.com "Hello, Friend" ~/logfile.txt -f "Trebuchet MS" -s 14

On Windows, the same command works after installation. The only difference is the path style, for example:

smvp friend@gmail.com "Hello, Friend" .\logfile.txt -f "Trebuchet MS" -s 14

Force plain-text handling for HTML-like input:

smvp friend@gmail.com "Raw Markup" ./snippet.txt --content-type text

Force HTML handling:

smvp friend@gmail.com "Rendered Markup" ./fragment.txt --content-type html

For more details, run:

smvp -h

Development

Local development requires uv, just, Git, and Git Cliff. After installing those tools, run:

just setup
just check

Use just changelog to preview user-facing changes. Release preparation uses just bump <version> followed by just tag-release from an up-to-date main branch.

Pull-request titles use Conventional Commits. Accepted types are feat, change, deprecate, remove, fix, security, perf, deploy, docs, revert, build, chore, ci, refactor, style, and test.

Metadata

Release files for smvp 0.4.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smvp 0.4.12
File Size Uploaded
smvp-0.4.12.tar.gz 28.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smvp 0.4.12
File Interpreter ABI Platform
smvp-0.4.12-py3-none-any.whl Python 3 none any Details

Total release size: 38.4 kB

Release files / smvp-0.4.12.tar.gz

Download URL smvp-0.4.12.tar.gz
Size 28.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fcd32218222c54edb5f32b748955e520821de1ff52d0167ecdf8a9909808db35
BLAKE2b-256 checksum
How to use checksums
f448dfb45239ef1230f6b1fb66d597bfdc960f183be45f46f82e1a32af4b87ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release files / smvp-0.4.12-py3-none-any.whl

Download URL smvp-0.4.12-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4c17397feb279ce389e1d1048479509ac89cdb9e833a25eccfc704c570a1024
BLAKE2b-256 checksum
How to use checksums
99766d0f72b0d4f8da9046045716b1b32517f898bde08f8e14898740710b434f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.12 This release

2 release files

0.4.11

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.16

2 release files

0.2.14

2 release files

0.2.13

2 release files

0.2.12

2 release files

0.2.11

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page