summaryrefslogtreecommitdiff
path: root/sms.d/phone
blob: 4e4ddd7fc4dd3f54504f3cd62b3a4295650c4a82 (plain)
  1. #!/bin/sh
  2. # if an error occurs, break immediately
  3. set -e
  4. # Variables from Kannel sms gateway
  5. sms_phone="$SMS_PHONE"
  6. sms_fromphone="$1"
  7. app="$2"
  8. shift 2
  9. msg="$*"
  10. # Settings for the "mail" outgoing email command
  11. export smtp=mail.bitbase.dk
  12. export from=hp@fossasia.org
  13. export sender="$from"
  14. # Send message (...just to stdout if invoking from cmdline)
  15. sendit() {
  16. if [ -n "$sms_phone" ]; then
  17. mail -s "[sms] phone $sms_fromphone" hp@fossasia.org mb@fossasia.org
  18. else
  19. cat
  20. fi
  21. }
  22. # Check keyword and break after processing if it matches
  23. case "$app" in
  24. phone)
  25. cat <<EOF | sendit
  26. Someone at $sms_fromphone sent an sms to $sms_phone with keyword phone
  27. and this message (supposedly his/her name):
  28. $msg
  29. EOF
  30. exit 1
  31. ;;
  32. esac