Scheduled Emailer

A simple email scheduler that runs on a cron trigger in Val Town.

Features

  • Sends emails at scheduled times
  • Customizable email content
  • Configurable recipient (defaults to val owner)

Setup Instructions

  1. The val has been set up with a cron trigger
  2. Important: You need to configure the cron schedule in the Val Town web UI:
    • Go to the val in your Val Town dashboard
    • Click on the "Cron" tab
    • Set your desired schedule using cron syntax (e.g., 0 9 * * * for daily at 9 AM)

Customization

You can customize the email content by modifying the DEFAULT_EMAIL object in the code:

const DEFAULT_EMAIL: EmailConfig = { subject: "Scheduled Email", text: "This is your scheduled email from Val Town.", html: "<h1>Scheduled Email</h1><p>This is your scheduled email from Val Town.</p>", to: "optional-recipient@example.com" // Remove this line to send to yourself };

Advanced Usage

For more advanced use cases, you can modify the code to:

  • Fetch dynamic content from an API
  • Send different emails based on the day of the week
  • Include personalized content
  • Send to multiple recipients

Troubleshooting

If emails are not being sent:

  1. Check the val's logs for any error messages
  2. Verify that the cron schedule is set correctly
  3. Ensure you have permission to send emails from Val Town