A Hono-based web application for previewing and sending personalized welcome emails with Discord notifications.
This Val provides a user-friendly interface to preview and send customized welcome emails to new users. It's designed to integrate with automation workflows (like Discord bots or webhooks) where you can generate quick links for team members to review and approve emails before sending.
Generate a URL with the following query parameters:
https://send-lead-gen-email.val.run?name=John+Doe&email=john@example.com&title=Software+Engineer&org=Acme+Corp
name: Full name of the recipient (e.g., "John Doe")email: Email address of the recipienttitle: Job title (e.g., "Software Engineer")org: Organization/company name (e.g., "Acme Corp")The role description in the email is automatically built from
the title and org parameters:
Set these in your Val Town environment:
GMAIL_USER - Gmail address for sending emailsGMAIL_PASS - Gmail app password (not your regular password)DISCORD_WEBHOOK - Discord webhook URL for notificationsEdit the email content by modifying these files:
Use these template variables:
{{firstName}} - First name extracted from full name{{roleDescription}} - Auto-generated role description{{subject}} - Email subject line.
āāā main.ts # Hono server and routes
āāā email-template.ts # Email generation logic
āāā pages.ts # HTML page templates
āāā discord.ts # Discord webhook notifications
āāā email.html # Email HTML template
āāā email.txt # Email text template
āāā README.md # This file
When an email is successfully sent, a Discord notification is posted with:
generateEmailPreview() - Generates email content from templatesbuildRoleDescription() - Creates personalized role descriptionssendDiscordNotification() - Sends Discord webhook on email sendgeneratePreviewPage() - Renders the preview UI