/trigger/reminder-email.ts
In the Trigger.dev Cloud we automatically pause execution of tasks when they are waiting for
longer than a few seconds. You are not charged when execution is paused.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Wait until a date, then continue execution.
export const sendReminderEmail = task({
id: "send-reminder-email",
run: async (payload: { to: string; name: string; date: string }) => {
//wait until the date
await wait.until({ date: new Date(payload.date) });
//todo send email
const { data, error } = await resend.emails.send({
from: "hello@trigger.dev",
to: payload.to,
subject: "Don't forget…",
html: `<p>Hello ${payload.name},</p><p>...</p>`,
});
},
});
throwIfInThePastawait wait.until({ date: new Date(date), throwIfInThePast: true });
Was this page helpful?
