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
@stevekrouse.testEmail2 is
steverkouse.testEmail2@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 this function here:
Test it out yourself by sending an email to
steverkouse.testEmail2@valtown.email
and your email should show up in this
list above.