Skip to content

Instantly share code, notes, and snippets.

@AfvanMoopen
Created February 20, 2021 17:47
Show Gist options
  • Save AfvanMoopen/c11b453ef6ec2dfc3d765f19b7659f1b to your computer and use it in GitHub Desktop.
Save AfvanMoopen/c11b453ef6ec2dfc3d765f19b7659f1b to your computer and use it in GitHub Desktop.
ip_address="1.2.3.4"
from_user="someone@foobar.com"
to_user="user@foobar.com"
smtp_host="gogogo.gogo.com"
smtp_user="someone@foobar.com"
smtp_password="nomention"
df -h | grep -E "(Filesystem|sda)" | mail -S smtp-auth-user=${smtp_user} -S smtp-auth-password=${smtp_password} -S smtp=${smtp_host} -s "[LOG] ${ip_address} Disk Usage Report $(date +\%y/\%m/\%d)" -r ${from_user} -c ${to_user} ${to_user}
# cat msg | mail -b "bcc_user@foobar.com" -s "Email" "user@foobar.com"
# msmtp version
a='Subject: IP Address\n\n'; b=$(curl -s https://ifconfig.co); echo -e $a$b | msmtp myemail.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment