In this example we will show you how to send an email using WUHU when a low temperature alert occurs.

Download sendEmail-v156

Unzip the sendmail.exe into your c:\program files\wuhu (default) folder.

The Sendmail command line parameters are:

sendEmail.exe-1.56 by Brandon Zehm <caspian@dotconf.net>

Synopsis:  sendEmail.exe -f ADDRESS [options]

  Required:
    -f ADDRESS                from (sender) email address
    * At least one recipient required via -t, -cc, or -bcc
    * Message body required via -m, STDIN, or -o message-file=FILE

  Common:
    -t ADDRESS [ADDR ...]     to email address(es)
    -u SUBJECT                message subject
    -m MESSAGE                message body
    -s SERVER[:PORT]          smtp mail relay, default is localhost:25

  Optional:
    -a   FILE [FILE ...]      file attachment(s)
    -cc  ADDRESS [ADDR ...]   cc  email address(es)
    -bcc ADDRESS [ADDR ...]   bcc email address(es)
    -xu  USERNAME             username for SMTP authentication
    -xp  PASSWORD             password for SMTP authentication

  Paranormal:
    -b BINDADDR[:PORT]        local host bind address
    -l LOGFILE                log to the specified file
    -v                        verbosity, use multiple times for greater effect
    -q                        be quiet (i.e. no STDOUT output)
    -o NAME=VALUE             advanced options, for details try: --help misc
        -o message-content-type=<auto|text|html>
        -o message-file=FILE         -o message-format=raw
        -o message-header=HEADER     -o message-charset=CHARSET
        -o reply-to=ADDRESS          -o timeout=SECONDS
        -o username=USERNAME         -o password=PASSWORD
        -o tls=<auto|yes|no>         -o fqdn=FQDN

  Help:
    --help                    the helpful overview you're reading now
    --help addressing         explain addressing and related options
    --help message            explain message body input and related options
    --help networking         explain -s, -b, etc
    --help output             explain logging and other output options
    --help misc               explain -o options, TLS, SMTP auth, and more

Next open notepad.exe.  We will want to create a batch file called SendEmailLowIndoorTemp.bat.  Here is an example:

Paste the following into notepad, and update your (-f) from email address, the (-t) to email address, (-u) the subject if you want, the (-m) body of the message if you want, as well as your user account, password, and mail server.

sendemail -f myemail@myisp.com -t myemail@myisp.com -u "Warning: Low Temperature Detected" -m "Low Indoor Temperature detected %1 F" -xu myispaccount -xp mypassword -s smtp.myispcom:25

Make sure you replace the myemail@myisp.com with your valid email address, as well as your isp account and password, and your mail server.

Gmail Example:

sendemail -f myemail@gmail.com -t myemail@gmail.com -u "Warning: Low Temperature Detected" -m "Low Indoor Temperature detected %1 F" -xu mygmailaccount -xp mygmailpassword -s smtp.gmail.com:587

Save either example to c:\program files\wuhu\SendEmailLowIndoorTemp.bat

Since we inserted a %1 in this batch file; we can now pass arguments into the batch file and have them show up in the email.  More on that later.

Next we will run the batch file by staring a new command prompt.  (Start -> Run -> CMD)

Then type:

cd "\Program Files\WUHU"
SendEmailLowIndoorTemp.bat 32

You will see the application run:

C:\Program Files\WUHU>sendemail -f me@myisp.com -t me@myisp.com -u "Warning: Low Temperature Detected" -m "Low indoor temperature was detected: 32 F" -xu me@myisp.com -xp PASSWORD -s smtp.myisp.com:25

Feb 13 23:39:22 <your machine> sendemail[6008]: Email was sent successfully!

If you receive:

-date- <your machine> sendemail[1048]: ERROR => Received: 535 Authentication failed

or

-date- <your machine> sendemail[2204]: ERROR => smtp.gmail.com:995 returned a zero byte response to our query.

Double check your user name and password, and server are correct.

 

Next,  We will Setup WUHU to send the email.

Launch WUHU if it isn’t running already.

Select the Actions button from the main menu.

 

On the actions screen select the Weather Data you want to Alert on, and send an email.   In this example we will be alerting on Low Indoor Temperature when it falls below 33.0 Deg F.

Change the Low Indoor Temperature value to 33.0 F (or what ever you wish)

Next, click the Sound/Action button next to Low Indoor Temperature

This will bring up the Actions Dialog:

On this dialog, Under the Action on Activation section click the browse button:

This will bring up the Open Dialog,  Change the files of type to *.*, then Select the SendEmailLowIndoorTemp.bat that we created earlier, and click ok.

It should now look like:

Now the fun part,  You can insert the detected temperature into the SendEmailLowIndoorTemp.bat.   Remember that %1 we used earlier?  That is what parameter 1 is going to be.

So from the drop down list Pick Variable:  Select the %IndoorTempDegF% and put double quotes around it.  So it looks like below, then Click OK.

 

 

WUHU will now send emails when the temperature hits 33 deg F.