Sign inSign up

elswork/mailutils

By elswork

•Updated 8 months ago

# MailUtils A Docker file to build an image with `mailutils` and `ssmtp` to send emails.

Image
Message queues
Developer tools
1

2.8K

elswork/mailutils repository overview

⁠MailUtils

A Docker⁠ file to build an image with mailutils and ssmtp to send emails.

⁠Details

Docker PullsDocker StarsSizeSponsors
Docker pullsDocker starsDocker Image sizeGitHub Sponsors

⁠Compatible Architectures

This image has been built and tested using buildx⁠ for these architectures:

  • amd64 arm64 arm/v7

⁠Build Instructions

docker build -t elswork/mail-sender .

⁠Usage

⁠Build the image
make build
⁠Run the container
make run
⁠Send a test email
make send-test-mail
⁠Stop the container
make stop
⁠Remove the container
make rm

⁠Shell Aliases and Functions

You can add the following aliases and functions to your .bashrc, .zshrc or similar shell configuration file to easily send emails from your command line.

Note: These examples assume your container is named my-mail-sender and your email is [email protected]. Remember to change them to match your configuration.

⁠Send command history (mh)

This alias, named mh (for "mail history"), sends your shell's command history to your email.

alias mh="history | docker exec -i my-mail-sender mail -s \"\$(whoami) \$(uname -nr) \$(awk -F= '\$1==\"PRETTY_NAME\" { print \$2 ;}' /etc/os-release)\" [email protected]"
⁠Send command output (mailme)

This shell function, named mailme, allows you to send the output of any command to your email.

mailme() {
  if [ -z "$1" ]; then
    echo "Usage: mailme <command>"
    echo "Example: mailme ls -l"
    return 1
  fi

  # The subject includes the command name ($1) for clarity
  SUBJECT="Output of command: $1"
  
  "$@" | docker exec -i my-mail-sender mail -s "$SUBJECT" [email protected]
}

Usage examples:

# Send the content of a file
mailme cat /path/to/your/file.txt

# Send the list of running processes
mailme ps aux

# Send a system report
mailme ./system_report.sh

⁠Funding and Donations

Sponsor me!⁠ Together we will be unstoppable.

Other ways to fund me:

⁠GitHub Sponsors Donate PayPal

Donate with Bitcoin (BTC):

bc1qfxsxxcr2akh2l26m6am0vpwwkhnsua04lmgfef

View on Blockchain.com⁠


Donate with Ethereum (ETH):

0x186b91982CbB6450Af5Ab6F32edf074dFCE8771c

View on Etherscan⁠


Please note that donations are voluntary and non-refundable. Thank you for your generosity!

Tag summary

Content type

Image

Digest

sha256:6dc2b4848…

Size

45.3 MB

Last updated

8 months ago

docker pull elswork/mailutils