Author Topic: how to call sendmail function  (Read 305 times)

Offline adizero

  • Member
  • **
  • Posts: 259
how to call sendmail function
« on: May 18, 2016, 10:51:56 AM »
mga bro

meron kami existing shell script.   pero missing "send_email.sh"    pano kaya macapture ang lahat ng output value below like uptime and date   sa send_email.sh ?

check_status.sh  will run thru crontab and automatic nya tatawagin si send_email.sh


Problem :  Pano ma capture lahat ng data from check_status and magamit ang mutt email command  sa function from different script which is send_email.sh?   meron at least 3 functions sa loob ng check_status.sh

                      mutt -s "SUBJECT" email@emailaddress.com < testmail.txt[/font]



Example :

File name : check_status.sh

send_status()
{

cat | send_email -s $SUBJECT <<EOF1 &

Computer Time
-------------
`date -u`

System Uptime
-------------
`uptime`

Offline barurutor

  • Moderators
  • Member
  • *
  • Posts: 3445
  • The Truth Shall Make Ye Fret.
Re: how to call sendmail function
« Reply #1 on: May 18, 2016, 11:51:51 AM »
generate the email message first then call send_mail with the completed message, no inline shell commands or anything.
<insert witty saying or hobby specs here>