• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
petermillspaugh

petermillspaugh

docs

markdown docs site
Public
Like
docs
Home
Code
5
components
4
images
1
pages
2
styles
1
H
index.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
pages
/
vals
/
email.md
Code
/
pages
/
vals
/
email.md
Search
10/16/2025
Viewing readonly version of main branch: v466
View latest version
email.md
title:
Email
description:
A kind of val that is able to receive emails sent to it

Email triggers provide a unique email address for your val. When Val Town receives an email at that address, it triggers the corresponding file within the val with the email as its first argument.

Some common examples include:

  • Automatically forwarding emails
  • Posting support team emails to Discord / Slack

Vals can send email, too! Using the email function in the standard library.

Type Signature

Files triggered by Email receive an argument called Email that represents the email that was sent. Here's an example:

Create val
export async function emailValHandler(email: Email) { console.log("Email received!", email.from, email.subject, email.text); for (const file of email.attachments) { console.log(`Filename: ${file.name}`); console.log(`Content Type: ${file.type}`); console.log(`Content: ${await file.text()}`); } }

The Email type has this shape:

Create val
interface Email { from: string; to: string[]; cc: string | string[] | undefined; bcc: string | string[] | undefined; subject: string | undefined; text: string | undefined; html: string | undefined; attachments: File[]; }

Example

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

Custom email address

Similar to HTTP endpoints, you can set a custom email address by clicking on the Email trigger and selecting Custom email address.

You can choose any available email address ending in @valtown.email.

custom-email-add.png

Limitations

Note: Email size limit

The total size of inbound emails, including attachments, must be less than 30MB.

Email triggers are powered internally by Sendgrid Inbound Parse.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.