K2DT – Amateur Radio
Uncategorized

Text Alerts or Email from JTAlert makes state or DXCC hunting easier while using WSJT-X

I’ve been operating JT65, JT9, and now FT8.  It’s very helpful in getting new states for Worked All States awards and entities for DXCC.

I run on Windows 10 and use the excellent JTAlert (http://hamapps.com) program to help automate logging and to track what new entities I need on a per-band basis.

Since I have WAS for 80, 40, 20, and 15 meters, I’d like to complete WAS for 10m to qualify for the 5-Band WAS award.   10 meters is open periodically but I can’t be in front of the radio (or even in the house) all the time.

Now I get texts sent to my cell phone when a new state pops up on 10m at my QTH and I’ll show you how to do it.   Caution: This only applies to Windows 10 users and JTAlert 2.13.7 or higher (that’s what I’m running – use other versions at your own peril).

Power Shell Script

First create a Power Shell script that will send the email.   It should have a “ps1” extension.  I named mine “emailalert.ps1”.  I use a private SMTP server which uses SSL.

$EmailFrom = “youremail@yourdomain.com”  (substitute your email address)

$EmailTo = “8885551212@vtext.com” (substitute your Verizon phone number.  Other providers will use a different domain if they provide the email to text facility.  If you want to receive the notification as an email, substitute the email address it should be sent to)

$Subject =”” (I leave it blank so it isn’t include in a text.  For email you can set a subject like “JTAlert notification”)

$Body = $Env:JTAlert_AlertType+” “+ $Env:JTAlert_State+” “+ $Env:JTAlert_Country+” “+ $Env:JTAlert_Call+” “+ $Env:JTAlert_Band  (Fills in the alert text from JTAlert environment variables it sets before calling the custom executable)

$SMTPServer = “yoursmtpservername.com”

$SMTPClient = New-Object Net.Mail.SmtpClient($SMTPServer, PORTNUM)  (Change PORTNUM to the port number of your SMTPServer.   Usually 25 for non-SSl and 587 for SSL.  If you set up your email program, you should have had to set these same parameters)

$SMTPClient.EnableSsl = $true (use $false if your server doesn’t use SSL security.  It’s better if it does!)

$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“youremaillogin”,”youremailpassword”) (this sets up your login name and password for using the SMTP server)

$SMTPClient.send($EmailFrom,$EmailTo,$Subject,$Body) (sends the email through Windows)

Batch File

Now that the Power Shell script is set up, you need to be able to invoke it from JTAlert.  You can probably do this directly, but I chose to use a simple batch file to do this.  The extension should be “.bat”.  I named mine “emailalert.bat”

powershell -executionpolicy bypass -InputFormat Text -File “C:\fullpathname\emailalert.ps1” (of course you substitute the fully-qualified filename of the Power Shell script you created earlier)

JTAlert Configuration

In JTAlert, go to “Settings” – “Manage Settings (F11)” – “Alerts” – “Miscellaneous Alerts” – “User Defined Alert”

On this panel, check the box to enable the user defined alert, select what triggers you want to use, specify how often JTAlert should re-send an Alert should it still apply.  For “Alert Application” and “Application Path”, specify the fully-qualified filename (ie, drive, path, and filename) of the batch file created in the last step.

Save the settings and press the “Test” button to see if it works.

I don’t think I had to restart JTAlert or WSJT-X but I had a report that it was required for at least one person, so it’s worth trying if you’re having trouble.

Trouble?

Note that in JTAlert, I did specify the full path to the batch file eg: C:\Users\Wayne\Documents\Amateur Radio\emailalert.bat   If you don’t specify the full path, JTAlert may not find it.

You can test your batch file directly at the command by setting some or all of the environment variables first, eg:

C:> set JTAlert_AlertType=”Test Alert”

C:> set JTAlert_State=AZ

C:> set JTAlert_Call=K2DT

C:> set JTAlert_Band=10m

C:> C:\Users\Wayne\Documents\Amateur Radio\emailalert.bat

If this works and you specify the full path to the batch file in JTAlert, I’d expect the Test button to give similar results.

Good Luck!

73 de K2DT

PS – I can’t help you if you are using an operating system other than Windows 10

6 comments

  1. Was wondering if you could check over my bat and ps1 files and see what I am doing wrong. I am a for sure nubie when it comes to this. If it is ok ill send you the files to your email on qrz
    Thanks Terry N8JX

  2. If you want your alert to also include the Grid Square, you would add this to the alert: $Env:JTAlert_Grid+”

  3. Hello Wayne —

    Just a quick question. When you say “private SMTP server…” are you referring to one that you have locally, or via a 3rd party? For example I can set up my own private SMTP server with a Linux build that I have — or go to some 3rd party service like Mailgun, Sendgrid, etc.

    Thanks so much and 73,

    Chuck Wyatt
    Newtown, CT
    NE1CW

    1. Chuck,

      I meant that I use a Virtual Private Server (VPS) for my email, including the SMPT server. This is not required at all. Since I had configured it of course I’m very familiar with how it’s set up.

      This should work for any provider you use as long as you get the correct setup from them to use in configuring the script. The settings should be the same as you use for your mail client to send email from your computer.

      73,
      Wayne

Leave a Reply

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.