# MailUtils A Docker file to build an image with `mailutils` and `ssmtp` to send emails.
664
A Docker file to build an image with mailutils and ssmtp to send emails.
| Website | GitHub | Docker Hub |
|---|---|---|
| Deft.Work my personal blog | MailUtils | mailutils |
This image has been built and tested using buildx for these architectures:
docker build -t elswork/mail-sender .
make build
make run
make send-test-mail
make stop
make rm
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.
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]"
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
Sponsor me! Together we will be unstoppable.
Other ways to fund me:
Donate with Bitcoin (BTC):
bc1qfxsxxcr2akh2l26m6am0vpwwkhnsua04lmgfef
Donate with Ethereum (ETH):
0x186b91982CbB6450Af5Ab6F32edf074dFCE8771c
Please note that donations are voluntary and non-refundable. Thank you for your generosity!
Content type
Image
Digest
sha256:6dc2b4848…
Size
45.3 MB
Last updated
5 months ago
docker pull elswork/mailutils