Skip to content

Commit

Permalink
v2.6.0 (#14) (#155)
Browse files Browse the repository at this point in the history
1、支持多域名
2、支持PostgreSQL数据库
3、更新全部依赖
4、支持垃圾箱邮件删除

Co-authored-by: jinnrry <[email protected]>
  • Loading branch information
Jinnrry and Jinnrry authored Jul 14, 2024
1 parent 402e001 commit 9ffbdf4
Show file tree
Hide file tree
Showing 34 changed files with 387 additions and 215 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/unitTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ jobs:
MYSQL_DATABASE: pmail
MYSQL_ROOT_PASSWORD: githubTest
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

postgres:
image: postgres
env:
POSTGRESQL_PASSWORD: githubTest
container:
image: golang
env:
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,7 @@ test:
export setup_port=17888 && cd server && go test -v ./...

test_mysql:
export setup_port=17888 && cd server && go test -args "mysql" -v ./...
export setup_port=17888 && cd server && go test -args "mysql" -v ./...

test_postgres:
export setup_port=17888 && cd server && go test -args "postgres" -v ./...
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ beautiful and cute Logo for this project!
> 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
Expand Down
3 changes: 3 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ PMail是一个追求极简部署流程、极致资源占用的个人域名邮箱

只要支持pop3、smtp协议的邮件客户端均可使用

### 6、多域名、多用户支持

支持多域名、多用户且完整支持收发邮件

# 如何部署

Expand Down
Binary file modified docs/cn.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 14 additions & 10 deletions fe/src/i18n/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ var lang = {
"sender": "Sender",
"title": "Title",
"date": "Date",
"to": "To:",
"cc": "Cc:",
"sender_desc": "Only the email prefix is required",
"to": "To",
"cc": "Cc",
"sender_desc": "Sender",
"to_desc": "Recipient's e-mail address",
"cc_desc": "Cc's e-mail address",
"send": "send",
Expand All @@ -44,6 +44,7 @@ var lang = {
"SetDomail": "Set Domain",
"setDNS": "Set DNS",
"setSSL": "Set SSL",
"dns_root_desc": "Fill in the \"@\" or empty, as determined by your domain name service provider.",
"setDatabase": "Set Database",
"setAdminPassword": "Set Password",
"admin_account": "Administrator Account",
Expand All @@ -57,10 +58,13 @@ var lang = {
"type": "Type",
"db_select_ph": "please select your database",
"mysql_dsn": "MySQL DSN",
"pg_dsn": "PostgreSQL DSN",
"sqlite_db_path": "Data File Path",
"domain_desc": "Set your domain infomation.",
"smtp_domain": "SMTP Domain",
"web_domain": "Web Domain",
"multi_domain_setting": "Multi-Domain Setting",
"multi_domain_setting_desc": "Bind this mailbox to multiple domains.",
"dns_desc": "Please add the following information to your DNS records",
"ssl_auto": "Automatically configure SSL certificates (recommended)",
"wait_desc": "Please Wait.",
Expand Down Expand Up @@ -89,8 +93,6 @@ var lang = {
"rule_do":"Do the following:",
"from":"From Email Address",
"subject":"Email Subject",
"to":"Recipient's address",
"cc":"Cc's address",
"content":"Email Content",
"equal":"Equal",
"regex":"Regex Match",
Expand Down Expand Up @@ -127,9 +129,9 @@ var zhCN = {
"sender": "发件人",
"title": "主题",
"date": "时间",
"to": "收件人:",
"cc": "抄送:",
"sender_desc": "只需要邮箱前缀",
"to": "收件人",
"cc": "抄送",
"sender_desc": "发件人",
"to_desc": "接收人邮件地址",
"cc_desc": "抄送人邮箱地址",
"send": "发送",
Expand All @@ -150,6 +152,9 @@ var zhCN = {
"settings": "设置",
"security": "安全",
"SetDomail": "域名设置",
"dns_root_desc": "填入@或者空,不同域名服务商写法不同",
"multi_domain_setting": "多域名设置",
"multi_domain_setting_desc": "将此邮箱绑定到多个域名上",
"setDNS": "DNS设置",
"setSSL": "SSL设置",
"setDatabase": "数据库设置",
Expand All @@ -165,6 +170,7 @@ var zhCN = {
"type": "类型",
"db_select_ph": "请选择你的数据库",
"mysql_dsn": "MySQL DSN",
"pg_dsn": "PostgreSQL DSN",
"sqlite_db_path": "存储位置",
"domain_desc": "设置你的域名信息。",
"smtp_domain": "SMTP域名地址",
Expand Down Expand Up @@ -197,8 +203,6 @@ var zhCN = {
"rule_do":"执行操作:",
"from":"发件人地址",
"subject":"邮件主题",
"to":"收件人地址",
"cc":"抄送地址",
"content":"邮件内容",
"equal":"等于",
"regex":"正则匹配",
Expand Down
31 changes: 24 additions & 7 deletions fe/src/views/EditerView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
<div id="main">
<el-form label-width="100px" :rules="rules" ref="ruleFormRef" :model="ruleForm" status-icon>
<el-form-item :label="lang.sender" prop="sender">
<el-input :disabled="!$userInfos.is_admin" v-model="ruleForm.sender" :placeholder="lang.sender_desc"></el-input>

<div style="display: flex;">
<el-input style="max-width: 300px" :disabled="!$userInfos.is_admin" v-model="ruleForm.sender" :placeholder="lang.sender_desc" />
<div>@</div>
<el-select v-model="ruleForm.pickDomain">
<el-option :value="item" v-for="item in ruleForm.domains">{{ item }}</el-option>
</el-select>
</div>

</el-form-item>


Expand Down Expand Up @@ -84,7 +92,7 @@ import lang from '../i18n/i18n';
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
import { i18nChangeLanguage } from '@wangeditor/editor'
import { useRouter } from 'vue-router';
const router = useRouter();
const router = useRouter();
import useGroupStore from '../stores/group'
const groupStore = useGroupStore()
import { getCurrentInstance } from 'vue'
Expand All @@ -93,9 +101,9 @@ const $http = app.appContext.config.globalProperties.$http
const $isLogin = app.appContext.config.globalProperties.$isLogin
const $userInfos = app.appContext.config.globalProperties.$userInfos
if (lang.lang == "zhCn"){
if (lang.lang == "zhCn") {
i18nChangeLanguage('zh-CN')
}else{
} else {
i18nChangeLanguage('en')
}
Expand Down Expand Up @@ -123,26 +131,35 @@ const ruleForm = reactive({
receivers: '',
cc: '',
subject: '',
domains:[],
pickDomain:""
})
const fileList = reactive([]);
const init =function(){
const init = function () {
if (Object.keys($userInfos.value).length == 0) {
$http.post("/api/user/info", {}).then(res => {
if (res.errorNo == 0) {
$userInfos.value = res.data
ruleForm.sender = res.data.account
ruleForm.domains = res.data.domains
ruleForm.pickDomain = res.data.domains[0]
} else {
ElMessage({
type: 'error',
message: res.errorMsg,
})
}
})
}else{
ruleForm.sender = $userInfos.value.account
ruleForm.domains = $userInfos.value.domains
ruleForm.pickDomain = $userInfos.value.domains[0]
}
}
init()
ruleForm.sender = $userInfos.value.account
const validateSender = function (rule, value, callback) {
Expand Down Expand Up @@ -240,7 +257,7 @@ const send = function (formEl) {
let text = editorRef.value.getText()
$http.post("/api/email/send", {
from: { name: ruleForm.sender, email: "" },
from: { name: ruleForm.sender, email: ruleForm.sender + "@" +ruleForm.pickDomain },
to: objectTos,
cc: objectCcs,
subject: ruleForm.subject,
Expand Down
28 changes: 21 additions & 7 deletions fe/src/views/EmailDetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,27 @@
<el-divider />

<div>
<span>{{ lang.to }}:
<span class="userItem" v-for="to in tos">{{ to.Name }} {{ to.EmailAddress }} ;</span>
</span>

<span v-if="showCC">{{ lang.cc }}:
<span class="userItem" v-for="ccs in cc">{{ cc.Name }} {{ cc.EmailAddress }} ;</span>
</span>
<div>{{ lang.to }}:
<el-tooltip v-for="to in tos" class="box-item" effect="dark" :content="to.EmailAddress" placement="top">
<el-tag size="small" type="info">{{to.Name != '' ? to.Name : to.EmailAddress }}</el-tag>
</el-tooltip>
</div>

<div v-if="showCC">{{ lang.cc }}:
<el-tooltip v-for="item in ccs" class="box-item" effect="dark" :content="item.EmailAddress" placement="top">
<el-tag size="small" type="info">{{item.Name != '' ? item.Name : item.EmailAddress }}</el-tag>
</el-tooltip>
</div>

<div>{{ lang.sender }}:
<el-tooltip class="box-item" effect="dark" :content="detailData.from_address" placement="top">
<el-tag size="small" type="info">{{detailData.from_name != '' ? detailData.from_name : detailData.from_address }}</el-tag>
</el-tooltip>
</div>

<div>{{ lang.date }}:
{{ detailData.send_date }}
</div>
</div>
<el-divider />
<div class="content" id="text" v-if="detailData.html == ''">
Expand Down
43 changes: 23 additions & 20 deletions fe/src/views/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="move(group.id)" v-for="group in groupList">{{ group.name
}}</el-dropdown-item>
}}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
Expand All @@ -26,43 +26,43 @@
<el-table ref="taskTableDataRef" @selection-change="selectionLineChange" :data="data" :show-header="true"
:border="false" @row-click="rowClick" :row-style="rowStyle">
<el-table-column type="selection" width="30" />
<el-table-column prop="title" label="" width="50">
<el-table-column prop="is_read" label="" width="50">
<template #default="scope">
<div>
<span v-if="!scope.row.is_read">
{{ lang.new }}
</span>
<span style="font-weight: 900;color: #FF0000;" v-if="scope.row.dangerous">
<el-tooltip effect="dark"
:content="lang.dangerous"
placement="top-start">
<el-tooltip effect="dark" :content="lang.dangerous" placement="top-start">
!
</el-tooltip>

</span>
<span style="font-weight: 900;color: #FF0000;" v-if="scope.row.error != ''">
<el-tooltip effect="dark"
:content="scope.row.error"
placement="top-start">
<el-tooltip effect="dark" :content="scope.row.error" placement="top-start">
!
</el-tooltip>

</span>
</div>
</template>
</el-table-column>
<el-table-column prop="title" :label="lang.sender" width="150">
<template #default="scope">
<span v-if="scope.row.is_read">
<div v-if="scope.row.sender.Name != ''">{{ scope.row.sender.Name }}</div>
{{ scope.row.sender.EmailAddress }}
</span>
<span v-else style="font-weight:bolder;">
<div v-if="scope.row.sender.Name != ''">{{ scope.row.sender.Name }}</div>
{{ scope.row.sender.EmailAddress }}
</span>
<el-tooltip class="box-item" effect="dark" :content="scope.row.sender.EmailAddress" placement="top">
<el-tag size="small" type="info">{{scope.row.sender.Name != '' ? scope.row.sender.Name : scope.row.sender.EmailAddress }}</el-tag>
</el-tooltip>
</template>
</el-table-column>

<el-table-column prop="title" :label="lang.to" width="150">
<template #default="scope">
<el-tooltip v-for="toInfo in scope.row.to" class="box-item" effect="dark" :content="toInfo.EmailAddress" placement="top">
<el-tag size="small" type="info">{{toInfo.Name != '' ? toInfo.Name : toInfo.EmailAddress }}</el-tag>
</el-tooltip>
</template>
</el-table-column>

<el-table-column prop="desc" :label="lang.title">
<template #default="scope">
<div v-if="scope.row.is_read">{{ scope.row.title }}</div>
Expand Down Expand Up @@ -103,7 +103,7 @@ const app = getCurrentInstance()
const $http = app.appContext.config.globalProperties.$http
const router = useRouter();
const router = useRouter();
const groupStore = useGroupStore()
Expand Down Expand Up @@ -222,6 +222,9 @@ const del = function () {
ids.push(element.id)
});
let groupTag = JSON.parse(tag)
ElMessageBox.confirm(
lang.del_email_confirm,
'Warning',
Expand All @@ -232,7 +235,7 @@ const del = function () {
}
)
.then(() => {
$http.post("/api/email/del", { "ids": ids }).then(res => {
$http.post("/api/email/del", { "ids": ids ,"forcedDel":groupTag.status == 3 }).then(res => {
if (res.errorNo == 0) {
updateList()
ElMessage({
Expand Down
Loading

0 comments on commit 9ffbdf4

Please sign in to comment.