MCPcopy Index your code
hub / github.com/Jinnrry/PMail

github.com/Jinnrry/PMail @v2.9.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.9.3 ↗ · + Follow
698 symbols 2,196 edges 141 files 134 documented · 19%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PMail

A server, a domain, a line of code, a minute, and you'll be able to build a domain mailbox of your own.

中文文档

I'm Chinese, and I'm not good at English, so I apologise for my translation.

Introduction

PMail 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!

Editor

Features

  • 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 score 10 points if correctly configured.
  • Implementing the ACME protocol, the program will automatically obtain and update Let's Encrypt certificates.

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)

  • 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.

How to run

0、Check You IP / Domain

First go to spamhaus and check your domain name and server IP for blocking records

1、Download

  • Click Here Download a program file that matches you.
  • Or use Docker docker pull ghcr.io/jinnrry/pmail:latest

2、Run

./pmail -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.

[!IMPORTANT] The SSL certificate will not be set automatically if the bootstrap setup phase uses a port other than 80.

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

3、Configuration

Open http://127.0.0.1 in your browser or use your server's public IP to visit, then follow the instructions to configure.

4、Email Test

Check if your mailbox has completed all the security configuration. It is recommended to use https://www.mail-tester.com/ for checking.

Configuration file format description

{
  "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/pmail.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.
}

Mail Client Configuration

POP3 Server Address : pop.[Your Domain]

POP3 Port: 110/995(SSL)

SMTP Server Address : smtp.[Your Domain]

SMTP Port: 25/465、587(SSL)

IMAP Server Address : imap.[Your Domain]

IMAP Port: 993(SSL)

Plugin

WeChat Push

Spam Block

Community plugins

Telegram Push

Plugin Install

[!IMPORTANT] Plugins run on your server as independent processes, please review the security of third-party plugins on your own.PMail currently only maintains the three plugins mentioned above.

Copy plugin binary file to /plugins

For Developer

Project Framework

1、 FE: vue3+element-plus

The code is in fe folder.

2、Server: golang + MySQL/SQLite

The code is in server folder.

3、How to build

make build

4、Unit test

make test

Api Documentation

go to wiki

Plugin Development

go to wiki

Extension points exported contracts — how you extend this code

EmailHook (Interface)
(no doc) [4 implementers]
server/hooks/framework/framework.go
Match (Interface)
(no doc) [3 implementers]
server/services/rule/match/base.go
LoginAuthenticator (FuncType)
Authenticates users with an username and a password.
server/listen/smtp_server/login.go
HandlerFunc (FuncType)
(no doc)
server/controllers/base.go
Callback (FuncType)
(no doc)
server/utils/async/async.go

Core symbols most depended-on inside this repo

FPrint
called by 92
server/dto/response/response.go
Close
called by 43
server/utils/smtp/smtp.go
v
called by 41
server/hooks/spam_block/static/jquery.js
Run
called by 39
server/hooks/framework/framework.go
ce
called by 39
server/hooks/spam_block/static/jquery.js
Select
called by 34
server/listen/imap_server/session_select.go
Wait
called by 32
server/utils/async/async.go
ToString
called by 31
server/dto/tag.go

Shape

Function 439
Method 158
Struct 91
TypeAlias 5
FuncType 3
Interface 2

Languages

Go88%
TypeScript12%
Python1%

Modules by API surface

server/hooks/spam_block/static/jquery.js80 symbols
server/main_test.go34 symbols
server/listen/imap_server/imap_server_test.go30 symbols
server/utils/smtp/smtp.go27 symbols
server/dto/parsemail/email.go23 symbols
server/dto/parsemail/encodedword.go20 symbols
server/services/group/group.go19 symbols
server/services/list/imap_search.go18 symbols
server/hooks/wechat_push/wechat_push.go17 symbols
server/listen/pop3_server/action.go16 symbols
server/hooks/framework/framework.go16 symbols
server/hooks/spam_block/spam_block.go15 symbols

Datastores touched

pmailDatabase · 1 repos

For agents

$ claude mcp add PMail \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact