zeldor.biz

Linux, programming and more

Copyright © 2019 · Wintersong Pro Theme on Genesis Framework · WordPress · 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 Debian Debian squeeze DIY Fedora FTP Fun GIT Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring Munin MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python qemu RAID Roundcube rsync security ssh SSL Ubuntu virtualization Windows Windows 7 Wordpress

Leave a Reply Cancel 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