Loading...
Loading...
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.
npx skill4agent add val-town/plugins emailstd/emailfileType: "email"// 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);
}exportexport defaultlinks.emailstd/emailstd/emailimport { email } from "https://esm.town/v/std/email";
await email({
to: "user@example.com",
subject: "Hello",
text: "Message body",
});std/emailemailemail({ ... })email.sendtosubjecttexthtmlfromccbccreplyToattachmentsheaderstofromemailimport { email } from "https://esm.town/v/std/email";
export default async function (e: Email) {
await email({
to: e.from,
subject: `Re: ${e.subject ?? ""}`,
text: "Got it, thanks!",
});
}run_fileEmailget_logs