outline |
---|
deep |
This application uses the Cloudflare Email Worker
to implement a temporary email service.
The body of which contains two parts
Email Worker
- Receive mailRemix Web Application
- Showcase Mailer
There are a few things we need to do to get the application deployed and ready for use.
The database used for this library is SQLit
by Turso
. (It is possible to use the individual free plans directly. Portal - Turso)
This project utilizes cloudflare email services. So make sure you have a Cloudflare account to deploy and use the application. Portal - Cloudflare Dashboard
The following environment variables help the application to quickly use the relevant information.
# Cookie encryption secret, random string will do.
COOKIES_SECRET: xxxx
# Fetched from cloudflare, used for CAPTCHA
TURNSTILE_KEY: xxxx
# Get from turso, connect to database with
TURNSTILE_SECRET: xxx
# Get, connection credentials in turso
TURSO_DB_RO_AUTH_TOKEN: xxx
# Getting, connecting to database address in turso
TURSO_DB_URL: xxx
Viewable source file 0000_sturdy_arclight.sql
CREATE TABLE `emails` (
`id` text PRIMARY KEY NOT NULL,
`message_from` text NOT NULL,
`message_to` text NOT NULL,
`headers` text NOT NULL,
`from` text NOT NULL,
`sender` text,
`reply_to` text,
`delivered_to` text,
`return_path` text,
`to` text,
`cc` text,
`bcc` text,
`subject` text,
`message_id` text NOT NULL,
`in_reply_to` text,
`references` text,
`date` text,
`html` text,
`text` text,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL
);
- Execute the publish command in the current project
$ cd yourprojectpath/email-worker && pnpm run deploy
- Find Email Worker in the workers-and-pages section of cloudflare and add the following environment variable to the settings:
# Get, connection credentials in turso
TURSO_DB_RO_AUTH_TOKEN: xxx
# Getting, connecting to database address in turso
TURSO_DB_URL: xxx
- Enter the domain's email/email routing/routing rules Set catch-all action to send to worker, destination email-worker
- Execute the deploy command on the current project
# This is a fly.io deployment. You can also use other methods, this is the standard remix project
$ cd yourprojectpath/apps/remix && fly launch
-
Add the above environment variables.
-
Deployment is complete. Visiting the deployed site is the same as the current example https://smail.pw. Try it out.