Skip to content

Commit

Permalink
Add admin mailer. (#103)
Browse files Browse the repository at this point in the history
* Add admin mailer.

Fixes #83

This was a nightmare
 - Nodemailer worked great, but Cloudflare doesn't allow full node.js and optional imports are a pain
 - Cloudflare a big fat dirty liars. Give an API that can only be tested on server, then once you finally get it working after 20 deploys, it's canceled. https://blog.cloudflare.com/sending-email-from-workers-with-mailchannels/ 

Resend is great: up and running in 5 mins.
  • Loading branch information
scosman authored Jul 25, 2024
1 parent a8013b6 commit 0343770
Show file tree
Hide file tree
Showing 7 changed files with 468 additions and 50 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,18 @@ If you prefer another host you can explore alternatives:
- [Community adapters](https://sveltesociety.dev/components#adapters) including Github pages, AppEngine, Azure, and more
- [Supabase](https://supabase.com/docs/guides/getting-started/quickstarts/sveltekit) if you want one host for everything. Note: they do charge $10 a month for custom domains, unlike Cloudflare.
## Setup Admin Emailer -- Optional
SaaS Starter includes an admin emailer for sending yourself email notifications when important events happen. This let's you monitor your app and respond to users without watching the database.
If you setup the admin emailer, it will email you when users create their profile, or when the 'Contact Us' form is submitted. You can add additional calls to sendAdminEmail() for any other events you want to monitor.
To setup, set these environment variables:
- `PRIVATE_ADMIN_EMAIL`: the email address to which admin emails will be sent.
- `PRIVATE_FROM_ADMIN_EMAIL`: the email address to use as the from address for admin emails (defaults to `PRIVATE_ADMIN_EMAIL` if not set).
- `PRIVATE_RESEND_API_KEY`: a https://resend.com API key. Note, you'll need to verify your domain with them before you can use their service.
## Add Your Content
After the steps above, you’ll have a working version like the demo page. However, it’s not branded, and doesn’t have your content. The following checklist helps you customize the template to make a SaaS homepage for your company.
Expand Down
8 changes: 8 additions & 0 deletions local_env_template
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Supabase settings
PUBLIC_SUPABASE_URL='https://REPLACE_ME.supabase.co'
PUBLIC_SUPABASE_ANON_KEY='REPLACE_ME'
PRIVATE_SUPABASE_SERVICE_ROLE='REPLACE_ME'

# Stripe settings
PRIVATE_STRIPE_API_KEY='REPLACE_ME'

# settings for email - optional
# PRIVATE_ADMIN_EMAIL='[email protected]'
# PRIVATE_FROM_ADMIN_EMAIL='REPLACE_ME'
# PRIVATE_RESEND_API_KEY='REPLACE_ME'
Loading

0 comments on commit 0343770

Please sign in to comment.