Sending Emails on Startup when Gaming

I've been playing the video game Magic the Gathering: Arena (aka MTGA) altogether too much. My brother asked me to alert him every time I play. One way to do this is to send an email every time I start the game.

I looked up how to send emails programmatically on Windows (the platform MTGA runs on). I found a perl program called sendemail that does this. The program is hosted on an official-seeming page from 2009, a sourceforce page which was last updated in 2009, and a github page last updated in 2012 which all seem to be the same program. I picked the most recently edited of these three thinking it might have some fixes (or maybe a backdoor!). After installing strawberry perl and doing a naive invocation, I was met with:

$ perl path/to/sendEmail -f "aozgaa AT gmail DOT com" -u "starting mtg arena" -t "aozgaa AT gmail DOT com" -s "smtp.gmail.com:587" -o tls=yes -xu "aozgaa AT gmail DOT com" -xp 'mypassword' -m "some message"
invalid SSL_version specified at /home/daedalus/perl5/lib/perl5/IO/Socket/SSL.pm line 728.

Huh? It looks like this issue has been encountered before. So I tried a few things, and eventually this patch looked reasonable:

$ git diff
diff --git a/sendEmail b/sendEmail
index 9f9392e..8a8dec2 100755
--- a/sendEmail
+++ b/sendEmail
@@ -1903,7 +1903,7 @@ else {
     if ($conf{'tls_server'} == 1 and $conf{'tls_client'} == 1 and $opt{'tls'} =~ /^(yes|auto)$/) {
         printmsg("DEBUG => Starting TLS", 2);
         if (SMTPchat('STARTTLS')) { quit($conf{'error'}, 1); }
-        if (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'SSLv3 TLSv1')) {
+        if (! IO::Socket::SSL->start_SSL($SERVER)) {
             quit("ERROR => TLS setup failed: " . IO::Socket::SSL::errstr(), 1);
         }
         printmsg("DEBUG => TLS: Using cipher: ". $SERVER->get_cipher(), 3);

(Note, it looks like this is necessary on both Windows and Linux). Now I get:

$ perl /path/to/sendEmail -f "aozgaa AT gmail DOT com" -u "starting mtg arena" -t "aozgaa AT gmail DOT com" -s "smtp.gmail.com:587" -o tls=yes -xu "aozgaa AT gmail DOT com" -xp 'mypassword' -m "some message"
Mar 15 16:16:57 daedalus-arch sendEmail[56559]: ERROR => ERROR => SMTP-AUTH: Authentication to smtp.gmail.com:587 failed.

Putting in my actual password (you didn't think it was that bad, did you?) didn't work. I enabled IMAP in gmail's settings. Stack Overflow stopped giving answers, so I continued searching and found Google's password help where I was reminded that I have 2-Factor authentication enabled. So I needed to make an app password. I chose a Windows password for mail because, well, that's what we're doing. Finally, I used the app password, and now I can send an email to myself (or my brother!). I then made a (powershell) script that sends an email then runs MTGA:

perl /path/to/sendEmail -f "aozgaa AT gmail DOT com" -u "starting mtg arena" -t "aozgaa AT gmail DOT com" -s "smtp.gmail.com:587" -o tls=yes -xu "aozgaa AT gmail DOT com" -xp 'apppassword' -m "some message"

&"C:\Program Files (x86)\Wizards of the Coast\MTGA\MTGALauncher\MTGALauncher.exe"

Now I can go back to feeding my addiction.