From e4766c63475f1efdedc74117e04aeeba3e9225e9 Mon Sep 17 00:00:00 2001 From: gujiangjiang Date: Fri, 17 Oct 2025 05:51:22 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=20README.md=EF=BC=8C?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=20Turso=20=E5=92=8C=20Vercel=20=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8F=8F=E8=BF=B0=EF=BC=8C=E5=90=8C=E6=AD=A5=E4=B8=BA?= =?UTF-8?q?=20Cloudflare=20+=20D1=20=E6=9E=B6=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 86 +++++++++++++++++++++++++++++++--------------------- README_en.md | 78 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 105 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index f86fe4b..1305a05 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@

𝐕𝐌𝐀𝐈𝐋.𝐃𝐄𝐕

Discord · English | 简体中文

-

使用 Cloudflare email worker 实现的临时电子邮件服务

+

使用 Cloudflare Email Worker 实现的临时电子邮件服务

yesmore%2Fvmail | Trendshift -
[WR.DO](https://wr.do) 临时邮箱已上线,与 Vmail 同款原理,使用 CF 转发邮件,并支持发件,支持多域名。仓库:[oiov/wr.do](https://github.com/oiov/wr.do),体验地址: [wr.do/emails](https://wr.do/emails) @@ -14,57 +13,74 @@ - ✈️ 支持邮件收发 - ✨ 支持保存密码,找回邮箱 - 😄 支持多域名后缀 -- 🚀 快速部署,无需服务器 +- 🚀 快速部署,纯 Cloudflare 方案,无需服务器 原理: - Email worker 接收电子邮件 -- 前端显示电子邮件(remix) -- 邮件存储(sqlite) -- 发信使用 MailChannel API +- 前端 (Vite + React) 显示电子邮件 +- 邮件存储 (Cloudflare D1) +- 发信使用 MailChannels API ## 👋 自部署教程 +本项目已完全基于 Cloudflare Pages 和 Cloudflare D1 构建,大大简化了部署流程。您只需要一个托管在 Cloudflare 上的域名即可。 + ### 准备工作 - [Cloudflare](https://dash.cloudflare.com/) 账户与托管在 Cloudflare 上的域名 -- [turso](https://turso.tech) sqlite 数据库(个人免费计划足够) -- [Vercel](https://vercel.com) 或 [fly.io](https://fly.io) 账号部署前端用户界面 -- 本地安装 [Nodejs](https://nodejs.org) 环境 (版本 >= 18.x) +- 本地安装 [Node.js](https://nodejs.org) 环境 (版本 >= 18.x) 和 [pnpm](https://pnpm.io/installation) -### 接收邮件教程 +### 自动部署 (推荐) -查看 [receive-tutorial.md](/docs/receive-tutorial.md) +本项目已包含一个预先配置好的 GitHub Action 工作流,可以帮助您自动将 vMail 应用部署到 Cloudflare。 -### 发送邮件教程 +详细步骤请参考 [GitHub Action 自动部署教程](/docs/github-action-tutorial.md)。 -```JSON -注意:不再建议使用此方法,原因参考 issue#17,vmail.dev 将下线发件功能 -``` +### 手动部署步骤 -查看 [send-tutorial.md](/docs/send-tutorial.md) +1. **克隆项目到本地** + ```bash + git clone https://github.com/oiov/vmail + cd vmail + pnpm install + ``` + +2. **创建 Cloudflare D1 数据库** + 在 Cloudflare 控制台或使用 Wrangler CLI 创建一个 D1 数据库。 + +3. **配置 `wrangler.toml`** + 将根目录下的 `wrangler.toml` 文件中的 `${...}` 占位符替换为您的 Cloudflare 和 D1 配置信息。您也可以通过 Cloudflare Pages 的环境变量来设置这些值。 + +4. **构建和部署** + ```bash + # 构建前端应用 + pnpm run build + + # 部署到 Cloudflare + pnpm run deploy + ``` + Wrangler 将会自动处理前端静态资源和 Worker 的部署,并根据配置应用数据库迁移。 + +5. **配置电子邮件路由** + 在您的 Cloudflare 域名管理界面,进入 `Email` -> `Email Routing` -> `Routes`,设置一个 `Catch-all` 规则,将所有发送到您域名的邮件 `Send to a Worker`,选择您刚刚部署的 Worker。 ## 🔨 本地运行调试 -```bash -git clone https://github.com/oiov/vmail -cd vmail -# 安装依赖 -pnpm install +1. **复制环境变量文件** + ```bash + # 此命令会创建一个本地环境变量文件,wrangler dev 会自动加载 + cp .env.example .env + ``` -# 运行端口 localhost:3000 -pnpm run remix:dev -``` +2. **填写本地环境变量** + 在 `.env` 文件中填写必要的环境变量,特别是 `D1_DATABASE_ID` 等。您需要先在 Cloudflare 创建一个 D1 数据库用于本地开发。 -运行前复制 `apps/remix/.env.example` 文件并重命名为 `apps/remix/.env`,填写必要的环境变量。 - -## Deploy with Edgeone - -[![使用 EdgeOne Pages 部署](https://cdnstatic.tencentcs.com/edgeone/pages/deploy.svg)](https://edgeone.ai/pages/new?repository-url=https%3A%2F%2Fgithub.com%2Foiov%2Fvmail) - -## 🌈 下一步计划 - -- [ ] 使用 [Cloudflare D1](https://developers.cloudflare.com/d1/) 数据库重构,简化部署流程 +3. **启动开发服务器** + ```bash + pnpm run dev + ``` + 该命令会同时启动前端 Vite 开发服务器和本地的 Wrangler Worker 环境。 ## ❤️ 交流群 @@ -78,7 +94,7 @@ pnpm run remix:dev Please check out these previous works that helped inspire the creation of vmail. 🙏 - [akazwz/smail](https://github.com/akazwz/smail) -- [email.ml](email.ml) +- [email.ml](https://email.ml) ## 📝 License @@ -89,4 +105,4 @@ GNU General Public License v3.0 [![Star History Chart](https://api.star-history.com/svg?repos=oiov/vmail&type=Date)](https://star-history.com/#oiov/vmail&Date) -[![Powered by DartNode](https://dartnode.com/branding/DN-Open-Source-sm.png)](https://dartnode.com "Powered by DartNode - Free VPS for Open Source") +[![Powered by DartNode](https://dartnode.com/branding/DN-Open-Source-sm.png)](https://dartnode.com "Powered by DartNode - Free VPS for Open Source") \ No newline at end of file diff --git a/README_en.md b/README_en.md index 50c0473..1c69e55 100644 --- a/README_en.md +++ b/README_en.md @@ -2,8 +2,7 @@

𝐕𝐌𝐀𝐈𝐋.𝐃𝐄𝐕

Discord · English | 简体中文

Temporary email service build with email worker.

- - + ## Features @@ -11,49 +10,80 @@ - ✈️ Support email sending and receiving - ✨ Support saving passwords and retrieving email addresses - 😄 Support multiple domain name suffixes -- 🚀 100% open source, quick deployment, no server required +- 🚀 100% open source, quick deployment, pure Cloudflare solution, no server required -Principles: +Principles: -- Receiving emails (email worker) -- Display email (remix) -- Mail Storage (sqlite) -- [Nodejs](https://nodejs.org) >= 18 +- Receiving emails (Cloudflare Email Worker) +- Display email (Vite + React on Cloudflare Pages) +- Mail Storage (Cloudflare D1) +- [Node.js](https://nodejs.org) >= 18 -> Worker receives email -> saves to database -> client queries email +> Worker receives email -> saves to D1 database -> client queries email ## Self-hosted Tutorial +This project is now fully based on Cloudflare Pages and Cloudflare D1, which greatly simplifies the deployment process. All you need is a domain name hosted on Cloudflare. + ### Requirements - [Cloudflare](https://dash.cloudflare.com/) account and a domain name hosted on Cloudflare -- [turso](https://turso.tech) sqlite (a free plan available for personal use) -- [Vercel](https://vercel.com) or [fly.io](https://fly.io) to deploy Remix app +- Local installation of [Node.js](https://nodejs.org) (version >= 18.x) and [pnpm](https://pnpm.io/installation) -### Receiving Emails steps +### Automatic Deployment (Recommended) -See [receive-tutorial-en.md](/docs//receive-tutorial-en.md) +This project includes a pre-configured GitHub Action workflow to help you automatically deploy the vMail application to Cloudflare. -### Sending Emails steps +For detailed steps, please refer to the [GitHub Action Auto-Deployment Tutorial](/docs/github-action-tutorial.md). -See [send-tutorial-en.md](/docs/send-tutorial-en.md) +### Manual Deployment Steps + +1. **Clone the project locally** + ```bash + git clone https://github.com/oiov/vmail + cd vmail + pnpm install + ``` + +2. **Create a Cloudflare D1 Database** + Create a D1 database in the Cloudflare dashboard or using the Wrangler CLI. + +3. **Configure `wrangler.toml`** + Replace the `${...}` placeholders in the `wrangler.toml` file in the root directory with your Cloudflare and D1 configuration information. You can also set these values through environment variables in Cloudflare Pages. + +4. **Build and Deploy** + ```bash + # Build the frontend application + pnpm run build + + # Deploy to Cloudflare + pnpm run deploy + ``` + Wrangler will automatically handle the deployment of frontend static assets and the Worker, and apply database migrations according to the configuration. + +5. **Configure Email Routing Rules** + In your Cloudflare domain management interface, go to `Email` -> `Email Routing` -> `Routes`, set up a `Catch-all` rule, and set the action to `Send to a Worker`, selecting the Worker you just deployed. ## Local development -copy `apps/remix/.env.example` to `apps/remix/.env` and fill in the necessary environment variables. +1. **Copy the environment variable file** + ```bash + # This command creates a local environment variable file that wrangler dev will load automatically + cp .env.example .env + ``` -```bash -git clone https://github.com/oiov/vmail -cd vmail -pnpm install +2. **Fill in local environment variables** + Fill in the necessary environment variables in the `.env` file, especially `D1_DATABASE_ID`, etc. You need to create a D1 database in Cloudflare for local development first. + +3. **Start the development server** + ```bash + pnpm run dev + ``` + This command starts both the frontend Vite development server and the local Wrangler Worker environment at the same time. -# run on localhost:3000 -pnpm run remix:dev -``` ## Community Group -- 加微信 `yesmore_cc` 拉讨论群 (**备注你的职业**) - Discord: https://discord.gg/d68kWCBDEs ## License