New in the Wolfram Language: MailReceiverFunction
July 16, 2015 — Bob Sandheinrich, Development Manager, Document & Media Systems
Despite the ever-growing list of tools I have for communication, email remains one of the most important. I depend on email to find out about all sorts of things: my ultimate Frisbee game is rained out, flights to Denver are only $80, my Dropbox account is almost full, my neighbor’s cat is missing (again). While filters are able to hide the pure junk and sort everything else into reasonable categories, reading and responding to email still requires a lot of manual interaction. The new mail receivers in the Wolfram Language finally let me automatically interact with email.
MailReceiverFunction is a Wolfram Language function that I deploy to the cloud to operate on incoming emails. When I deploy a function, I get an email address. Emails sent to that address will be processed by the function.
For example, I have a neighborhood mailing list that people use for all sorts of things like missing cats, plumber recommendations, and furniture for sale. Recently, I was in the market for a new dining room table. Here is an example of a MailReceiverFunction that checks if incoming mail mentions a table, and if so, sends a second email to my Wolfram ID:
Now I can subscribe to the mailing list as “receiver+5DHCTKhQ@wolframcloud.com,” and I will only receive messages about tables. But I can do better. Why not search messages for the price and create a log with the information I want? The function func below will run in my Wolfram Cloud account every time the mail receiver address receives an email:
After some emails have been sent, I can retrieve the log by reading the log file in my Wolfram Cloud account.
Retrieving the data as a Dataset makes all sorts of sophisticated queries possible. Here, for example, are pictures of the tables that are under $200:
I’ve also had some fun using mail receivers as an address for receiving promotional emails. I made this one that creates a word cloud from incoming emails. When I come to a website that asks for an email address and I know I don’t want to be on their mailing list, I use this mail receiver instead. It’s usually not too hard to guess the source of the promotion.
Any Wolfram Language function can be used inside a mail receiver, so these examples are just a taste of what’s possible. I still spend plenty of time manually working my way through emails, but now as I read each message, I think about what a MailReceiverFunction could do with it instead.
MailReceiverFunction is supported in Version 10.2 of the Wolfram Language and Mathematica, and is rolling out soon in all other Wolfram products.