完成安全整改与配置系统重构阶段开发
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-08-28 00:42:28 +08:00
1 parent 6ec462895f
commit 18b6dfbdf7
26 files changed
+1913 -169

No files matched your search

+87 -81
View File
@@ -1,153 +1,159 @@
# Smail
> A server, a domain, a line of code, a minute, and you'll be able to build a domain mailbox of your own.
> 一台服务器、一个域名、一行代码、一分钟时间,你就能够搭建出一个自己的域名邮箱。
## [中文文档](./README_CN.md)
Smail是一个追求极简部署流程、极致资源占用的个人域名邮箱服务器。单文件运行,包含完整的收发邮件服务和Web端邮件管理功能。只需一台服务器、一个域名、一行代码、一分钟部署时间,你就能够搭建出一个自己的域名邮箱。
I'm Chinese, and I'm not good at English, so I apologise for my translation.
欢迎各类PR,无论你是修复bug、新增功能、修改翻译。另外,也为这个项目征集一个漂亮可爱的Logo!
## Introduction
<img src="./docs/cn.gif" alt="Editor" width="800px">
Smail is a personal email server that pursues a minimal deployment process and extreme resource consumption. It runs on
a single file and contains complete send/receive mail service and web-side mail management functions. Just a server , a
domain name , a line of code , a minute of deployment time , you will be able to build a domain name mailbox of your
own .
## 为什么写这个项目
All kinds of PR are welcome, whether you are fixing bugs, adding features, or optimizing translations. Also, call for a
beautiful and cute Logo for this project!
迫于越来越多的邮件服务商暂停了针对个人的域名邮箱服务(比如QQ邮箱、微软Outlook邮箱),因此考虑自建域名邮箱服务。
但是自建域名邮箱可选的程序并不多,且目标都不是针对个人使用场景设计的。个人服务器一般内存、CPU、硬盘配置都不高,针对公司场景使用的邮箱程序过于臃肿,
白白浪费资源。就拿我自己的服务器来说,我服务器配置为1核512M 10G硬盘,市面上绝大多数邮箱服务器安装上就把磁盘占满了,根本没法正常使用
<img src="./docs/en.gif" alt="Editor" width="800px">
## 项目优势
## Features
### 1、部署简单
* Single file operation and easy deployment.
* The binary file is only 15MB and takes up less than 10M of memory during the run.
* Support dkim, spf checksum, [Email Test](https://www.mail-tester.com/) score 10 points if correctly configured.
* Implementing the ACME protocol, the program will automatically obtain and update Let's Encrypt certificates.
使用Go语言编写,支持跨平台,编译后单文件运行,单文件包含完整的前后端代码。修改配置文件,运行即可。
> By default, a ssl certificate is generated for the web service, allowing pages to use the https protocol.
> If you have your own gateway or don't need https, set `httpsEnabled` to `2` in the configuration file so that the web
> service will not use https.
> (Note: Even if you don't need https, please make sure the path to the ssl certificate file is correct, although the web
> service doesn't use the certificate anymore, the smtp protocol still needs the certificate)
### 2、资源占用极小
* Support pop3, smtp protocol, you can use any mail client you like.
* Support multi-domain, multi-user and complete support for sending and receiving e-mail.
编译后二进制文件仅15MB,运行过程中占用内存10M以内。
### 3、安全方面
# How to run
支持dkim、spf校验。正确配置的情况下,Email Test得分10分。
## 0、Check You IP / Domain
### 4、自动SSL证书
First go to [spamhaus](https://check.spamhaus.org/) and check your domain name and server IP for blocking records
实现了ACME协议,程序将自动获取并更新Let’s Encrypt证书。
## 1、Download
默认情况下,会为web后台也生成ssl证书,让后台使用https访问,如果你有自己的网关层,不需要https的话,在配置文件中将 `httpsEnabled`
设置为 `2`,这样管理后台就不会使用https协议。( 注意:即使你不需要https,也请保证ssl证书文件路径正确,http协议虽然不使用证书了,但是smtp协议还需要证书)
* [Click Here](https://git.pcux.cn/xuans/Smail/releases) Download a program file that matches you.
* Or use Docker `docker pull ghcr.io/jinnrry/pmail:latest`
### 5、邮件客户端支持
## 2、Run
只要支持pop3、smtp、imap协议的邮件客户端均可使用
### 6、多域名、多用户支持
支持多域名、多用户且完整支持收发邮件
# 如何部署
## 0、检查IP、域名
先去[spamhaus](https://check.spamhaus.org/)检查你的域名和服务器IP是否有屏蔽记录
## 1、下载文件
* [点击这里](https://git.pcux.cn/xuans/Smail/releases)下载一个与你匹配的程序文件。
* 或者使用Docker运行 `docker pull ghcr.io/jinnrry/pmail:latest`
## 2、运行
`./smail -p 80`
> -p Set the http port of the bootstrap setup interface, the default is port 80, note that this parameter only affects the bootstrap setup phase, if you need to change the port after setup is complete, please modify the configuration file.
> `-p 指定引导设置界面的http端口,默认为80端口,注意该参数仅影响引导设置阶段,设置完成后如果需要修改端口请修改配置文件`
> [!IMPORTANT]
> The SSL certificate will not be set automatically if the bootstrap setup phase uses a port other than 80.
> 如果引导设置阶段使用非80端口,将无法自动设置SSL证书
Or
或者
`docker run -p 25:25 -p 80:80 -p 443:443 -p 110:110 -p 465:465 -p 587:587 -p 995:995 -p 993:993 -v $(pwd)/config:/work/config ghcr.io/jinnrry/pmail:latest`
> [!IMPORTANT]
> If your server has a firewall turned on, you need to open ports 25, 80, 110, 443, 465,587, 993, 995
> 如果你服务器开启了防火墙,你需要打开25、80、110、443、465、587、995、993端口
## 3、Configuration
## 3、配置
Open `http://127.0.0.1` in your browser or use your server's public IP to visit, then follow the instructions to
configure.
浏览器打开 `http://127.0.0.1` 或者是用你服务器公网IP访问,然后按提示配置
## 4、Email Test
## 4、邮箱得分测试
Check if your mailbox has completed all the security configuration. It is recommended to
use [https://www.mail-tester.com/](https://www.mail-tester.com/) for checking.
建议找一下邮箱测试服务(比如[https://www.mail-tester.com/](https://www.mail-tester.com/))进行邮件得分检测,避免自己某些步骤漏配,导致发件进对方垃圾箱。
# Configuration file format description
# 配置文件说明
```jsonc
{
"logLevel": "info", //log output level
"domain": "domain.com", // Your domain
"webDomain": "mail.domain.com", // web domain
"dkimPrivateKeyPath": "config/dkim/dkim.priv", // dkim key path
"sslType": "0", // ssl certificate update mode, 0 automatic, 1 manual
"SSLPrivateKeyPath": "config/ssl/private.key", // ssl certificate path
"SSLPublicKeyPath": "config/ssl/public.crt", // ssl certificate path
"dbDSN": "./config/smail.db", // database connect DSN
"dbType": "sqlite", //database type ,`sqlite` or `mysql`
"httpsEnabled": 0, // enabled https , 0:enabled 1:enablde 2:disenabled
"httpPort": 80, // http port . default 80
"httpsPort": 443, // https port . default 443
"spamFilterLevel": 0,// Spam Filtering Levels: 0: No filtering. 1: Filter when both SPF and DKIM fail (in the absence of valid recipient filtering). 2: Filter when SPF check fails (in the absence of valid recipient filtering). 3: Filter when DKIM check fails (in the absence of valid recipient filtering)
"isInit": true // If false, it will enter the bootstrap process.
"logLevel": "info", //日志输出级别
"domain": "domain.com", // 你的域名
"webDomain": "mail.domain.com", // web域名
"dkimPrivateKeyPath": "config/dkim/dkim.priv", // dkim 私钥地址
"sslType": "0", // ssl证书更新模式,0自动,HTTP模式,1手动、2自动,DNS模式
"SSLPrivateKeyPath": "config/ssl/private.key", // ssl 证书地址
"SSLPublicKeyPath": "config/ssl/public.crt", // ssl 证书地址
"dbDSN": "./config/smail.db", // 数据库连接DSN
"dbType": "sqlite", //数据库类型,支持sqlite 和 mysql
"httpsEnabled": 0, // web后台是否启用https 0默认(启用),1启用,2不启用
"spamFilterLevel": 0,// 垃圾邮件过滤级别,0不过滤、1 spf dkim 校验均失败时且无有效收件人过滤,2 spf校验不通过时且无有效收件人过滤 3,dkim 校验不过的时候且无有效收件人过滤
"httpPort": 80, // http 端口 . 默认 80
"httpsPort": 443, // https 端口 . 默认 443
"isInit": true // 为false的时候会进入安装引导流程
}
```
# Mail Client Configuration
# 第三方邮件客户端配置
POP3 Server Address : pop.[Your Domain]
POP3地址: pop.[你的域名]
POP3 Port: 110/995(SSL)
POP3端口: 110/995(SSL)
SMTP Server Address : smtp.[Your Domain]
SMTP地址: smtp.[你的域名]
SMTP Port: 25/465、587(SSL)
SMTP端口: 25/465、587(SSL)
IMAP Server Address : imap.[Your Domain]
IMAP地址: imap.[Your Domain]
IMAP Port: 993(SSL)
# Plugin
IMAP端口: 993(SSL)
[WeChat Push](server/hooks/wechat_push/README.md)
# 插件
[Spam Block](server/hooks/spam_block/README.md)
[微信推送](server/hooks/wechat_push/README.md)
# Community plugins
[垃圾邮件屏蔽](server/hooks/spam_block/README.md)
[Telegram Push](https://github.com/ydzydzydz/pmail_telegram_push)
# 其他优秀开源插件
## Plugin Install
[Telegram推送](https://github.com/ydzydzydz/pmail_telegram_push)
## 插件安装
> [!IMPORTANT]
> Plugins run on your server as independent processes, please review the security of third-party plugins on your own.Smail currently only maintains the three plugins mentioned above.
> 插件已独立进程的方式运行在你的服务器上,请自行审查第三方插件的安全性。Smail目前仅维护上述三款插件
Copy plugin binary file to `/plugins`
将插件二进制文件放到`plugins`文件夹中即可
# For Developer
# 参与开发
## Project Framework
## 项目架构
1、 FE: vue3+element-plus
1、前端: vue3+element-plus
The code is in `fe` folder.
前端代码位于 `fe`目录中,运行参考 `fe`目录中的README文件
2、Server: golang + MySQL/SQLite
2、后端: golang + MySQL/SQLite
The code is in `server` folder.
后端代码进入 `server`文件夹,运行 `main.go`文件
3、How to build
3、编译项目
`make build`
4、Unit test
4、单元测试
`make test`
## Api Documentation
## 后端接口文档
[go to wiki](https://git.pcux.cn/xuans/Smail/wiki/%E5%90%8E%E7%AB%AF%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3)
## Plugin Development
## 插件开发
[go to wiki](https://git.pcux.cn/xuans/Smail/wiki/%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91%E8%AF%B4%E6%98%8E)