Email handler vals get their own email address that you can send email to, and when Val Town receives that email, it triggers the val with the email as its first argument. Ever wanted a robot that you could forward emails to, or to be able to control something via an email trigger? With email handler vals it’s simple: they get their own, unique address.
Type Signature
Email handlers receive an argument called Email
and can do anything with it:
they can go on to reply to the email with the standard library,
or call methods in response to it.
The Email
type has this shape:
Example
The email address for a val @user.testEmail
would be user.testEmail@valtown.email
. Note that the username does not contain
a leading @
and that the email domain is valtown.email
.
You can view all the emails sent to your function with the following val: