• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
selem

selem

emailer

Public
Like
emailer
Home
Code
4
shared
1
README.md
H
email-scheduler-ui.ts
C
scheduled-emailer.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
5/19/2025
Viewing readonly version of main branch: v6
View latest version
README.md

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
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.