Save yourself from unwanted emails with TextExpander [Sponsor]
Thanks to TextExpander for sponsoring BrettTerpstra.com this week! This tip is pretty ingenious, if I do say so myself.
You might know all the ways that TextExpander can save you time, but did you also know that TextExpander can save you from unwanted emails?
Gmail and many other email providers support something called “plus addressing.” Let’s say your email address is “pixel@gmail.com”. You sign up for a mailing list, but you’re leery that it could lead to a flood of spam. You can add a “+” and a string of characters between the username and @ like so: “pixel+marketing@gmail.com”. You don’t have to set them up in your email account—you can make these receive-only addresses up on the spot.
Later, you start getting emails addressed to “pixel+marketing@gmail.com” that you never signed up for. You try to unsubscribe to them, but they keep coming. So you can then go into your email settings and create a filter for every email addressed to “pixel+marketing@gmail.com.” You can send them to the trash, your spam folder, or another email folder.
TextExpander can automate the creation of these plus addresses thanks to its built-in scripting capabilities. TextExpander supports three types of scripting: AppleScript, bash, and JavaScript. However, AppleScript and bash are only supported on our Mac client, while JavaScript Snippets work on Chrome, Mac, and Windows, as well as our Android and iOS beta apps.
(Tip: Know AppleScript or bash, but aren’t comfortable with JavaScript? Ask ChatGPT to convert the script to JavaScript. Be sure to specify that it’s for a TextExpander Snippet!)
Here’s the code. You can also subscribe to our Public Group to snag a copy. Check out our blog post for more details:
function generateRandomEmail() {
var randomNum = Math.floor(Math.random() * 10000); // Generate a random number
var email = "pixel+" + randomNum + "@gmail.com"; // Concatenate to create email
return email; // Return the email string
}
generateRandomEmail(); // Call the function and output the result
Here’s how to use it in TextExpander:
- Copy the JavaScript code above.
- Create a new Snippet in TextExpander.
- Set the Content Type to JavaScript.
- Paste the above code into the content field.
- Edit the email variable to reflect your email address.
- Give it an easy-to-remember abbreviation like em.random.
Try TextExpander free for 30 days. Check out TextExpander today and get 20% off using the code TERPSTRA
.