Skip to content

Email

Email vals get their own email address that you can send email to. When Val Town receives that email, it triggers the val with the email as its first argument.

Type Signature

Email vals receive an argument called Email that represents the email that was sent to the val. Here’s an example of an email val:

Example
export function emailValHandler(email: Email) {
console.log("Email received!", email.from, email.subject, email.text);
}

The Email type has this shape:

interface Email {
from: string;
to: string[];
subject: string | undefined;
text: string | undefined;
html: string | undefined;
}

Example

This val forwards any email it receives to me. Try it out by sending an email to stevekrouse.forwarder@valtown.email.

Limitations

Fork it on