1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Email alerts?

Discussion in 'Tomato Firmware' started by Duffman19, Aug 27, 2008.

  1. Duffman19

    Duffman19 Addicted to LI Member

    Is it possible to get my WRT54GS to ping an IP on my network, and if it times out 3 times for it to send out an email alert?

    Is that asking too much of my fab little router? :)
  2. mstombs

    mstombs Network Guru Member

    The script would be fairly easy - but Tomato doesn't have an email client - this could be added via jffs, but a better option now is persuade a mod author to enable the smtpclient in recent BusyBox.
  3. bico

    bico Addicted to LI Member

    To send e-mail messages from the router you can use a telnet connection to an external mailserver. Your ISP (Internet Service Provider) might give you access to such a mailserver. Here is a code snippet for how to implement it:

            if (
                    sleep \$DELAY
                    echo "HELO \$DOMAINNAME"
                    sleep \$DELAY
                    echo "MAIL FROM: \$FROM"
                    sleep \$DELAY
                    echo "RCPT TO: \$TO"
                    sleep \$DELAY
                    echo "DATA"
                    sleep \$DELAY
                    echo "Date: \$DATETIME"
                    echo "From: \$FROM"
                    echo "To: \$TO"
                    echo "Subject: \$SUBJECT"
                    echo "X-Mailer: \$MAILERNAME \$MAILERVERSION"
                    echo ""
                    echo "\$MESSAGE"
                    echo "."
                    sleep \$DELAY
                    echo "QUIT"
                    sleep \$DELAY
            ) | telnet \$MAILSERVERNAME \$MAILSERVERPORT; then
                    logger local7.warning -t "..." "WARNING: ..."
    Put this code within a "here document" wrapper in the "Init" script (script_init.sh), to generate a "Mailer" script (/tmp/mailer.sh). This script can then be called from wherever you want an e-mail message notification.

Share This Page