trying to send email through script

afflictedd2

Registered
Trying to send mail with the following script, I substitute $1 with the email address I want to send the email to.

Code:
#!/bin/bash
# script to send simple email
# email subject
SUBJECT="SET-EMAIL-SUBJECT"
# Email To ?
EMAIL="$1"
# Email text/message
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "This is an email message test"> $EMAILMESSAGE
echo "This is email text" >>$EMAILMESSAGE
# send an email using /bin/mail
mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

I have tried sending myself emails with this script, but I don't get anything. I also don't get an error which makes it more difficult to figure out what's wrong. Anyone know how to send an email through a script. My operating system is Leopard.

Ted.
 
Back
Top