Sign inSign up

hldev/mailutil-alpine

By hldev

โ€ขUpdated about 16 hours ago

Image
Developer tools
0

9.4K

hldev/mailutil-alpine repository overview

โ ๐Ÿ“ฌ alpine-mailutil

โ ๐Ÿšฆ Pipeline Status

pipeline status

Latest Release

โ ๐Ÿ“ฆ Image Versions

โ ๐Ÿงฑ Version v1.2.7
  • alpine: 3.24.1
  • msmtp: msmtp version 1.8.32
โ ๐Ÿงฑ Version v1.2.6
  • alpine: 3.23.4
  • msmtp: msmtp version 1.8.32
โ ๐Ÿงฑ Version v1.2.5
  • alpine: 3.23.2
  • msmtp: msmtp version 1.8.32
โ ๐Ÿงฑ Version v1.2.4
  • alpine: 3.23.0
  • msmtp: msmtp version 1.8.32
โ ๐Ÿงฑ Version v1.2.3
  • alpine: 3.22.2
  • msmtp: msmtp version 1.8.28
โ ๐Ÿงฑ Version v1.2.2
  • alpine: 3.22.1
  • msmtp: msmtp version 1.8.28
โ ๐Ÿงฑ Version v1.2.1
  • alpine: 3.22.0
  • msmtp: msmtp version 1.8.28
โ ๐Ÿงฑ Version v1.1.0
  • alpine: 3.21.3
  • msmtp: msmtp version 1.8.27
โ ๐Ÿงฑ Version v1.0.0
  • alpine: 3.21.3
  • msmtp: msmtp version 1.8.27

โ ๐Ÿท๏ธ Image Tags Description

  • latest: Points to the latest stable release (see above versions).
  • <version>: Specific version tags (e.g., v1.2.3, v1.2.2, etc.).
  • rolling: Points to the latest build (may be unstable), created daily without tests.
  • testing: Developer image for testing the build process, not for production use.

โ ๐Ÿ› ๏ธ Use of the Container

This container allows you to send simple emails from a Docker container using Alpine Linux and msmtp. It supports:

  • SMTP with or without authentication
  • TLS with optional certificate verification
  • Custom sender, recipient, subject, and body
  • Mounted custom TLS certificates
  • Encoding-safe mail body via BODY_FILE
  • Full UTF-8 / emoji support ๐ŸŽ‰

โ ๐Ÿš€ Basic Usage

Run the container with the required environment variables:

docker run --rm \
  -e SMTP_SERVER=smtp.example.com \
  -e SMTP_PORT=25 \
  -e [email protected] \
  -e [email protected] \
  -e SUBJECT="Notification from CI" \
  -e BODY="Your job completed successfully." \
  hldev/mailutil-alpine:latest

โ ๐Ÿ” Example with SMTP Authentication
docker run --rm \
  -e SMTP_SERVER=smtp.example.com \
  -e SMTP_PORT=587 \
  -e [email protected] \
  -e SMTP_PASS=supersecret123 \
  -e [email protected] \
  -e [email protected] \
  -e SUBJECT="Mail with Auth" \
  -e BODY="This message uses SMTP authentication." \
  hldev/mailutil-alpine:latest

โ ๐Ÿ”’ Skip TLS Certificate Check (for internal/testing)
docker run --rm \
  -e SMTP_SERVER=mail.internal.example.com \
  -e SMTP_PORT=25 \
  -e [email protected] \
  -e [email protected] \
  -e SUBJECT="Skip TLS Check" \
  -e BODY="This skips TLS certificate validation." \
  -e TLS_CERTCHECK=off \
  hldev/mailutil-alpine:latest

โ ๐Ÿ“„ Using a Mounted TLS Certificate
docker run --rm \
  -v "$PWD/certs:/certs:ro" \
  -e SMTP_SERVER=smtp.example.com \
  -e SMTP_PORT=587 \
  -e [email protected] \
  -e [email protected] \
  -e SUBJECT="Secure Mail" \
  -e BODY="This email uses a mounted CA cert for TLS." \
  -e TLS_CERT_PATH=/certs/smtp.pem \
  hldev/mailutil-alpine:latest

For long logs or external files, you can pass the email body via a mounted file:

docker run --rm \
  -v "$PWD/my-log.txt:/tmp/body.txt:ro" \
  -e SMTP_SERVER=smtp.example.com \
  -e SMTP_PORT=587 \
  -e [email protected] \
  -e SMTP_PASS=supersecret123 \
  -e [email protected] \
  -e [email protected] \
  -e SUBJECT="Daily Report" \
  -e BODY_FILE="/tmp/body.txt" \
  hldev/mailutil-alpine:latest

This method is ideal for logs and large output, and preserves special characters and emojis like ๐Ÿณ, โœ…, or ๐Ÿ”ฅ.


โ ๐Ÿ’ก Emoji and UTF-8 Support

Whether you use BODY or BODY_FILE, the container now fully supports UTF-8 content thanks to:

  • UTF-8 locales (musl-locales + ENV LANG=C.UTF-8)
  • Proper email headers (Content-Type: text/plain; charset=UTF-8)
  • 8bit encoding support

You can now safely write:

-e BODY="This is a โœ… test message with symbols like ๐Ÿณ and ๐Ÿš€"

โ ๐Ÿ›ก๏ธ Secure Your SMTP Password Using an .env File

Avoid exposing your credentials on the command line. Use a .env-mail file instead:

โ โœ… Example .env-mail
SMTP_SERVER=smtp.example.com
SMTP_PORT=587
[email protected]
SMTP_PASS=supersecret123
[email protected]
[email protected]
MAIL_SUBJECT=GitLab Update Report - 2025-05-04
โ โœ… Load it in a Bash Script
#!/bin/bash
. /srv/gitlab/.env-mail

LOGFILE="/srv/gitlab/logs/gitlab-update-$(date '+%Y-%m-%d_%H-%M-%S').log"
mkdir -p "$(dirname "$LOGFILE")"
echo "๐Ÿณ GitLab updated successfully." >> "$LOGFILE"

docker run --rm \
  -v "$LOGFILE:/tmp/body.txt:ro" \
  -e SMTP_SERVER="$SMTP_SERVER" \
  -e SMTP_PORT="$SMTP_PORT" \
  -e SMTP_USER="$SMTP_USER" \
  -e SMTP_PASS="$SMTP_PASS" \
  -e FROM="$FROM" \
  -e TO="$MAIL_TO" \
  -e SUBJECT="$MAIL_SUBJECT" \
  -e BODY_FILE="/tmp/body.txt" \
  hldev/mailutil-alpine:latest

โ โœ… Required Environment Variables
VariableDescription
SMTP_SERVERSMTP host to connect to
SMTP_PORTPort number (usually 25 or 587)
FROMSender email address
TORecipient email address (or list)
SUBJECTSubject line of the email
BODYBody of the email (inline)

โ โš™๏ธ Optional Environment Variables
VariableDescription
SMTP_USERSMTP username (if authentication is needed)
SMTP_PASSSMTP password
TLS_CERT_PATHPath to mounted TLS CA cert (e.g. /certs/root.pem)
TLS_CERTCHECKSet to off to disable cert verification
BODY_FILEPath to a file that contains the full email body

โ ๐Ÿ“ Changelog

โ [v1.2.7] - 2026-06-26
โ ๐Ÿ”„ Updated
  • Updated Alpine to 3.24.1
  • Updated msmtp to version 1.8.32
โ [v1.2.6] - 2026-04-19
โ ๐Ÿ”„ Updated
  • Updated Alpine to 3.23.4
  • Updated msmtp to version 1.8.32
โ [v1.2.6] - 2026-01-29
โ ๐Ÿ”„ Updated
  • Updated Alpine to 3.23.3
  • Updated msmtp to version 1.8.32
โ [v1.2.5] - 2025-12-19
โ ๐Ÿ”„ Updated
  • Updated Alpine to 3.23.2
  • Updated msmtp to version 1.8.32
โ [v1.2.4] - 2025-12-05
โ ๐Ÿ”„ Updated
  • Updated Alpine to 3.23.0
  • Updated msmtp to version 1.8.32
โ [v1.2.3] - 2025-10-09
โ ๐Ÿ”„ Updated
  • Updated Alpine to 3.22.2
โ [v1.2.2] - 2025-07-21
โ ๐Ÿ”„ Updated
  • Updated Alpine to 3.22.1
โ [v1.2.1] - 2025-06-03
โ ๐Ÿ”„ Updated
  • Updated Alpine to 3.22.0
  • Updated msmtp to version 1.8.28
โ [v1.1.0] - 2025-05-04
โ โœจ Added
  • โœ… Support for BODY_FILE environment variable to load email body from a mounted file.
  • ๐Ÿ“ง UTF-8 compatibility for email content including emojis (๐Ÿ˜Š, โœ…, ๐Ÿณ).
  • ๐Ÿ›ก๏ธ Recommended usage patterns for log email output and secure .env usage.
โ ๐Ÿ› ๏ธ Changed
  • Dockerfile: Added musl-locales and ENV LANG=C.UTF-8 for Unicode compatibility.
  • Mail script: Added email headers for UTF-8 support:
    • Content-Type: text/plain; charset=UTF-8
    • Content-Transfer-Encoding: 8bit
โ ๐Ÿงช Compatibility
  • Works with both:
    • -e BODY="..." for short inline messages
    • -e BODY_FILE="..." with volume mount for full logs

โ [v1.0.0] - 2025-05-02
โ ๐Ÿš€ Initial Release
  • Alpine-based image with msmtp for sending simple authenticated mail
  • Basic SMTP, TLS, and plaintext email support via environment variables

Tag summary

Content type

Image

Digest

sha256:3ed05ceeeโ€ฆ

Size

9.2 MB

Last updated

3 months ago

docker pull hldev/mailutil-alpine