Skip to content

Commit

Permalink
v2.6.3 (#187)
Browse files Browse the repository at this point in the history
1、支持发件昵称修改
2、垃圾邮箱识别增加英文数据集
  • Loading branch information
Jinnrry authored Aug 11, 2024
1 parent 95d4db9 commit 2bf2635
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 18 deletions.
12 changes: 7 additions & 5 deletions fe/src/i18n/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ var lang = {
"login": "login",
"search": "Search Email",
"inbox": "Inbox",
"sender": "Sender",
"sender": "Sender's Address",
"nick_name": "Sender's Nickname",
"title": "Title",
"date": "Date",
"to": "To",
Expand Down Expand Up @@ -128,11 +129,12 @@ var zhCN = {
"login": "登录",
"search": "搜索邮件",
"inbox": "收件箱",
"sender": "发件人",
"title": "主题",
"sender": "发件人地址",
"nick_name": "发件人昵称",
"title": "邮件主题",
"date": "时间",
"to": "收件人",
"cc": "抄送",
"to": "收件人地址",
"cc": "抄送人地址",
"sender_desc": "发件人",
"to_desc": "接收人邮件地址",
"cc_desc": "抄送人邮箱地址",
Expand Down
50 changes: 38 additions & 12 deletions fe/src/views/EditerView.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
<template>
<div id="main">
<el-form label-width="100px" :rules="rules" ref="ruleFormRef" :model="ruleForm" status-icon>
<el-form-item :label="lang.sender" prop="sender">

<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 :label="lang.sender" prop="sender">
<el-popover trigger="click" :width="600">
<template #reference>
<div
style="border: 1px solid #dcdfe6; border-radius:3px;height: 30px; line-height: 30px; padding: 0 5px 0 5px;">
<span style="font-size: 16px; font-weight: bolder;">{{ ruleForm.nickName }}</span>
<span> &lt;{{ ruleForm.sender }}@{{ ruleForm.pickDomain }}&gt;</span>
</div>
</template>
<template #default>
<div style="display: flex; flex-direction:column;">
<div style=" margin-bottom: 10px;">
<el-form-item :label="lang.sender" prop="sender">
<el-input style="max-width: 200px" :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>
</el-form-item>
</div>

<div>
<el-form-item :label="lang.nick_name" >
<el-input style="max-width: 300px" v-model="ruleForm.nickName" />
</el-form-item>
</div>

</div>
</template>
</el-popover>

</el-form-item>

Expand Down Expand Up @@ -127,12 +150,13 @@ const fileRef = ref();
const pickFile = ref();
const ruleFormRef = ref()
const ruleForm = reactive({
nickName: '',
sender: '',
receivers: '',
cc: '',
subject: '',
domains:[],
pickDomain:""
domains: [],
pickDomain: ""
})
const fileList = reactive([]);
Expand All @@ -145,17 +169,19 @@ const init = function () {
ruleForm.sender = res.data.account
ruleForm.domains = res.data.domains
ruleForm.pickDomain = res.data.domains[0]
ruleForm.nickName = res.data.name
} else {
ElMessage({
type: 'error',
message: res.errorMsg,
})
}
})
}else{
} else {
ruleForm.sender = $userInfos.value.account
ruleForm.domains = $userInfos.value.domains
ruleForm.pickDomain = $userInfos.value.domains[0]
ruleForm.nickName = $userInfos.value.name
}
}
Expand Down Expand Up @@ -257,7 +283,7 @@ const send = function (formEl) {
let text = editorRef.value.getText()
$http.post("/api/email/send", {
from: { name: ruleForm.sender, email: ruleForm.sender + "@" +ruleForm.pickDomain },
from: { name: ruleForm.nickName, email: ruleForm.sender + "@" + ruleForm.pickDomain },
to: objectTos,
cc: objectCcs,
subject: ruleForm.subject,
Expand Down
4 changes: 4 additions & 0 deletions server/controllers/email/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ func Send(ctx *context.Context, w http.ResponseWriter, req *http.Request) {
return
}

if reqData.From.Name == "" {
reqData.From.Name = ctx.UserName
}

if reqData.Subject == "" {
response.NewErrorResponse(response.ParamsError, "邮件标题必填", "邮件标题必填").FPrint(w)
return
Expand Down
18 changes: 17 additions & 1 deletion server/hooks/spam_block/export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ import (
"github.com/Jinnrry/pmail/db"
"github.com/Jinnrry/pmail/hooks/spam_block/tools"
"github.com/Jinnrry/pmail/models"
"github.com/spf13/cast"
"os"
)

func main() {
args := os.Args

var id int
if len(args) >= 2 {
id = cast.ToInt(args[1])
}

config.Init()
err := db.Init("test")
if err != nil {
Expand All @@ -27,7 +35,11 @@ func main() {
defer file.Close()
for {
var emails []models.Email
db.Instance.Table(&models.Email{}).Where("id > ?", start).OrderBy("id").Find(&emails)
if id > 0 {
db.Instance.Table(&models.Email{}).Where("id = ?", id).OrderBy("id").Find(&emails)
} else {
db.Instance.Table(&models.Email{}).Where("id > ?", start).OrderBy("id").Find(&emails)
}
if len(emails) == 0 {
break
}
Expand All @@ -39,6 +51,10 @@ func main() {
}
//fmt.Printf("0 \t%s %s\n", email.Subject, trim(trimHtml(email.Html.String)))
}
if id > 0 {
break
}

}

}
Loading

0 comments on commit 2bf2635

Please sign in to comment.