[SOLVED] [sSMTP] Right way for newline in body?
by littlebigman from LinuxQuestions.org on (#5Q9EJ)
Hello,
I'm using the following code to send an email once a week through CRON to check free disk space on a host.
For some reason, the body is either a bit messy, or empty altogether:
Code:~# cat show.free.disk.space.bash
#!/bin/bash
#This works fine when run manually at the command line
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
# Body: \Root partition 47 0.000000ull.
printf "To: me@isp.com\nSubject: Free Disk Space\n\n\Root partition $CURRENT% full." | ssmtp me@isp.com
# Empty body :-/
printf "To: me@isp.com\nSubject: Disk Space Alert\nRoot partition $CURRENT% full." | ssmtp me@isp.comAny idea why?
Thank you.
I'm using the following code to send an email once a week through CRON to check free disk space on a host.
For some reason, the body is either a bit messy, or empty altogether:
Code:~# cat show.free.disk.space.bash
#!/bin/bash
#This works fine when run manually at the command line
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
# Body: \Root partition 47 0.000000ull.
printf "To: me@isp.com\nSubject: Free Disk Space\n\n\Root partition $CURRENT% full." | ssmtp me@isp.com
# Empty body :-/
printf "To: me@isp.com\nSubject: Disk Space Alert\nRoot partition $CURRENT% full." | ssmtp me@isp.comAny idea why?
Thank you.