zeldor.biz

Linux, programming and more

Copyright © 2025
Log in

Mail command

September 15, 2011 by Igor Drobot Leave a Comment

My tiny mail-command collection of the very important administrator mail command.
You can test E-Mail-Server create scripts with this useful command or send yourself some notifications.

The simplest one:

1
echo Testing mail server | mail -s Test kiwi@zeldor.biz

echo Testing mail server | mail -s Test kiwi@zeldor.biz

One trick for subscriptions send mail with specific sender:

1
echo subscribe | mail -s "Subscribe" flask@librelist.com -- -r "kiwi@zeldor.biz"

echo subscribe | mail -s "Subscribe" flask@librelist.com -- -r "kiwi@zeldor.biz"

Test E-Mail rejection (if you don’t receive this mail your spamd ist working fine):

1
echo "XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X" | mail -s Your-Subject kiwi@zeldor.biz

echo "XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X" | mail -s Your-Subject kiwi@zeldor.biz

Send file content as a body of the message (really useful solution for logs):

1
mail -s "Backup failed" kiwi@zeldor.biz < backup.log

mail -s "Backup failed" kiwi@zeldor.biz < backup.log

Send output of system commands:

1
df -h | mail -s "HDD report" kiwi@zeldor.biz

df -h | mail -s "HDD report" kiwi@zeldor.biz

Send E-Mail with current date:

1
echo "Test: $(date)" | mail -s Test kiwi@zeldor.biz

echo "Test: $(date)" | mail -s Test kiwi@zeldor.biz

Filed Under: Linux, Mailing, Networking Tagged With: Debian, Linux, mail

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *

Yeaaah Cookie! We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok