emailer
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.
A simple email scheduler that runs on a cron trigger in Val Town.
- Sends emails at scheduled times
- Customizable email content
- Configurable recipient (defaults to val owner)
- The val has been set up with a cron trigger
- 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)
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
};
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
If emails are not being sent:
- Check the val's logs for any error messages
- Verify that the cron schedule is set correctly
- Ensure you have permission to send emails from Val Town