Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Covers email-type vals that handle incoming mail and sending mail through std/email in Val Town.
60% 100%+40 ptsof test cases passed
Passed 25 of 25 test cases with the skill, and 15 of 25 without it.
When an email containing attached PDF documents arrives at an email val in Val Town, what data type does the handler receive in the attachments field of the email payload?
Identifies attachments as an array of standard File objects
3 of 3 safety checks passed
Val Town supports both directions: vals can be triggered by incoming mail (email-type vals) and can send mail via std/email.
Email vals (fileType: "email") run when a message is delivered to the val's assigned address.
// Learn more: https://docs.val.town/vals/email/
// Email type: {
// from: string,
// to: string[],
// subject?: string,
// text?: string,
// html?: string,
// attachments: File[],
// headers: Record<string, string>
// }
export default async function (e: Email) {
console.log(e.from, e.subject, e.text);
}
The file must have an export — export default for the handler.
Maximum 30MB per message, including attachments. Larger messages will be rejected.
When you list files or create an email-type file, the response includes links.email — the address that triggers this val. Always read this from the API response. Never construct an email address yourself — the format is owned by the platform and may change.
std/emailFor outgoing mail, import from std/email:
import { email } from "https://esm.town/v/std/email";
await email({
Next to this one in the catalogue, plus more from the same author.