Set up an email address in the cloud that applies a function to all messages it receives.

Make a mail receiver function

Make a mail receiver function that responds to incoming email by sending a notification message:

  • MailReceiverFunction has access to a large number of email properties in addition to #From and #Subject.
  • By default, SendMail relays messages through the Wolfram Cloud, which requires you to have a Wolfram Cloud account.

Deploy the mail receiver function to the Wolfram Cloud

When deployed to the Wolfram Cloud, the mail receiver function responds to email sent to the address in the CloudObject output:

Test the deployed mail receiver function

Test the mail receiver by clicking the receiver link in the preceding CloudDeploy output:

The Wolfram System opens your email client so that you can compose a message. Enter a subject and message and send the message:

The receiver sends a response:

Notes

You will not see the effect of a cloud-deployed MailReceiverFunction unless its argument produces an external effect via SendMail, CloudPut, Export or a similar function.
You can test a mail receiver function with an MBOX file. This responds to the first message in the file:
The receiver function sends an email message: