From Val Town
Use when a val sends email, receives email, or is triggered by an incoming email. Covers email-type vals (the Email handler shape, attachment limits, the assigned val email address) and sending mail via std/email.
How this skill is triggered — by the user, by Claude, or both
Slash command
/vals:emailThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Val Town supports both directions: vals can be **triggered by** incoming mail (email-type vals) and can **send** mail via `std/email`.
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.send({
to: "[email protected]",
subject: "Hello",
text: "Message body",
});
email.send accepts the same shape you'd expect: to, subject, text, html, and standard fields. By default mail is sent from the val owner's address.
Combine the two — read the inbound from in an email-type handler, then call email.send to reply:
import { email } from "https://esm.town/v/std/email";
export default async function (e: Email) {
await email.send({
to: e.from,
subject: `Re: ${e.subject ?? ""}`,
text: "Got it, thanks!",
});
}
After editing an email-type val, use run_file with a sample Email payload to invoke the handler manually instead of waiting for a real incoming message. For send-only vals, run the script the same way and check get_logs for delivery errors.
npx claudepluginhub val-town/plugins --plugin valtownBlocks Edit/Write/Bash actions until Claude investigates importers, data schemas, and user instructions. Improves output quality by forcing concrete facts before edits.