mardi 24 février 2015

Send mail from BASH/SH file with mailx - mail is not being send


Hello I have this script in a file:



#!/bin/bash

# email subject
SUBJECT="New_fish.app_available"
# Email To?

# Email text/message
EMAILMESSAGE="/tmp/emailmessage.txt"
first_line="There's a new version of fish.app out!\n"
second_line="Please update your Cask!"
last_line=$first_line$second_line
echo $last_line
#echo "EOF" >>$EMAILMESSAGE
# send an email using /bin/mail
if curl -s http://fishshell.com/ | grep -q "files/2.1.1/fish.pkg"; then
echo "Change occured\n" &&
echo $last_line | mailx -s $SUBJECT MAIL_GOES_HERE &&
echo "Mail send"

else
echo "Nothing's changed"
fi


But when I run the file, I do not get a mail, I have tried different combinations of the command, but have been unable to fix it. Can anyone tell me what is wrong with the script ?


-Thanks in advance.



Aucun commentaire:

Enregistrer un commentaire