➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the mail command with important options and switches using examples.
3 minute read
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ███╗ ███╗ █████╗ ██╗██╗
# ████╗ ████║██╔══██╗██║██║
# ██╔████╔██║███████║██║██║
# ██║╚██╔╝██║██╔══██║██║██║
# ██║ ╚═╝ ██║██║ ██║██║███████╗
# ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚══════╝
#=============#
# CMD MAIL
#==============================##==============================#
echo "hello world" | mail -s "a subject" [email protected]
#
echo "This will go into the body of the mail." | mail -s "Hello world" [email protected]
#
mail -s "Hello world" [email protected] < /home/calvin/application.log
#
top -b -n 1 | mail -s "any subject" [email protected]
#
mail -s "Your Subject" [email protected] < /file/with/mail/content
#(/file/with/mail/content sh ould be a plaintext file, not a file attachment or an image, etc)
echo "Sending an attachment." | mutt -a file.zip -s "attachment" [email protected]
#
# ENTER then type message body then CTRL+D.
mail -s “Hello world” [email protected]
# Otherwise,
echo "This will go into the body of the mail." | mail -s "Hello world" [email protected]
# Or parse from file,
mail -s “Hello world” [email protected] < /tmp/message.log
# Use mutt for attaching file,
echo “Sending an attachment.” | mutt -a backup.zip -s “attachment” [email protected]
# Datei sich per Email zusenden
cat DATEI | mail -s MAILSUBJEKT [email protected]
wait_for_this.sh; echo "wait_for_this.sh finished running" | mail -s "Job Status Update" [email protected]
# Send an email from the terminal when job finishes
echo "This is the message body" | mutt -a "/path/to/file.to.attach" -s "subject of message" -- [email protected]
gzip -c mysqldbbackup.sql | uuencode mysqldbbackup.sql.gz | mail -s "MySQL DB" [email protected]
mail -s "Backup" -a mysqldbbackup.sql [email protected] < message.txt
or also:
cat message.txt | mail -s "Backup" -a mysqldbbackup.sql [email protected]
EHLO test.example.com
MAIL FROM:<ABSENDERADRESSE>
RCPT TO:<EMPFÄNGERADRESSE>
DATA
Subject: Testnachricht
(Leerzeile, erneut Enter drücken)
Das ist ein Test.
(Leerzeile, erneut Enter drücken)
.
QUIT
#==============================##==============================#
# CMD MAIL #
#==============================##==============================#
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command mail in a clear format. This allows users to quickly access the needed information for mail without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for mail are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.