Automating the E-Mail Process Can Make Regular Notifications Easy
Commonly, AutoHotkey users activate their default e-mail program and employ the Run, Mailto: command when automating Windows e-mail. In conjunction with other AutoHotkey automation techniques (such as those discussed in the chapters in Section 8.1, “Windows Automation” of the book Jack’s Motley Assortment of AutoHotkey Tips), scripts can control virtually every aspect of e-mail processing. However, you do run into a few issues when using a Windows e-mail program for sending an e-mail with AutoHotkey:
- You must load and navigate the program every time you want to send a message.
- After AutoHotkey loads the application, any additional automation must fit the specific program (i.e. Windows Mail, Outlook, Mozilla Thunderbird, Web-based mail programs, etc).
- With most e-mail apps, the Run, Mailto: command does not automatically send the e-mail. It merely opens your default e-mail program and loads the text into a new e-mail window.
- The process can be slow and cumbersome.
The following blogs show how to write an AutoHotkey script for sending an e-mail while bypassing your e-mail program.
Using Windows CDO COM, You Can Send E-mail Without Opening Your E-mail Program
As part of the Component Object Model (COM) Microsoft offers a system called Collaboration Data Objects (CDO) which makes it possible to create and mail a message by sending a string of data directly to an e-mail server without any intervening e-mail software. By using this technique, we can write an AutoHotkey script which sends e-mail without using a client program normally associated with e-mail—whether desktop or Web-based.
Combining the Daily Horoscope from the Web with this AutoHotkey E-mail Sending Technique Makes It Possible to Deliver the Prescription to Anyone
E-mail—the oldest and most universal method for reaching people—offers a major advantage over text messages and other digital forms of communications (e.g. Twitter, Facebook). Most people own at least one e-mail address which they can access from any of their computers (PC, Mac, or Linux), any smartphone (iPhone or Android), or tablet. To send an e-mail, you don’t need to know a phone number or the type of device. E-mail servers push the message directly to the target addressee. Plus, using AutoHotkey, you can automate the periodic sending of an e-mail.
Adapting Web Scraping Routines to Changing Web Pages (AutoHotkey Tip) February 22, 2021
When the Horoscope Web Page I Use for E-mails Altered Its Format, I Quickly Adjusted the Script
I knew I could repair the Regular Expression (RegEx) in the broken script fairly quickly by following some basic steps:
- Access the source code for the target Web page and locate the key text.
- Copy the critical portion of the source code, including any unique HTML tags surrounding the target text, then paste the selection into Ryan’s RegEx Tester.
- Adjust the RegEx to include key unique tags surrounding the text—then extracting the paragraph.
- In the script, replace the old RegEx found in the RegExMatch() function with the new one from Ryan’s RegEx Tester.
- Make any necessary adjustments to the RegEx—primarily escaping double quotation marks.
Every e-mail server operates a little differently. It’s quite possible that some of them will not accept this type of automatic e-mail. Also, many providers place limits on how many e-mails you can send within a specific period of time. (This blocks people from sending an inordinate amount of Spam.) If you can’t get this script working for your AutoHotkey e-mail, then you may need to consult with your e-mail provider. Worst case, you can always set up a Gmail account just for use with AutoHotkey.
Click the Follow button at the top of the sidebar on the right of this page for e-mail notification of new blogs. (If you’re reading this on a tablet or your phone, then you must scroll all the way to the end of the blog—pass any comments—to find the Follow button.)
This post was proofread by Grammarly
(Any other mistakes are all mine.)
(Full disclosure: If you sign up for a free Grammarly account, I get 20¢. I use the spelling/grammar checking service all the time, but, then again, I write a lot more than most people. I recommend Grammarly because it works and it’s free.)
Find my AutoHotkey books at ComputorEdge E-Books!
Find quick-start AutoHotkey classes at “Robotic Desktop Automation with AutoHotkey“!