mirror of https://github.com/gogs/gogs.git
pkg/mailer: support custom mail subject prefix (#4524)
parent
63a263f542
commit
17d789a785
|
@ -226,8 +226,8 @@ PAGING_NUM = 10
|
|||
ENABLED = false
|
||||
; Buffer length of channel, keep it as it is if you don't know what it is.
|
||||
SEND_BUFFER_LEN = 100
|
||||
; Name displayed in mail title
|
||||
SUBJECT = %(APP_NAME)s
|
||||
; Prefix prepended to the subject line
|
||||
SUBJECT_PREFIX = `[%(APP_NAME)s] `
|
||||
; Mail server
|
||||
; Gmail: smtp.gmail.com:587
|
||||
; QQ: smtp.qq.com:465
|
||||
|
|
|
@ -1211,7 +1211,7 @@ config.skip_tls_verify = Skip TLS Verify
|
|||
config.mailer_config = Mailer Configuration
|
||||
config.mailer_enabled = Enabled
|
||||
config.mailer_disable_helo = Disable HELO
|
||||
config.mailer_name = Name
|
||||
config.mailer_subject_prefix = Subject Prefix
|
||||
config.mailer_host = Host
|
||||
config.mailer_user = User
|
||||
config.send_test_mail = Send Test Email
|
||||
|
|
2
gogs.go
2
gogs.go
|
@ -16,7 +16,7 @@ import (
|
|||
"github.com/gogits/gogs/pkg/setting"
|
||||
)
|
||||
|
||||
const APP_VER = "0.11.42.0330"
|
||||
const APP_VER = "0.11.43.0330"
|
||||
|
||||
func init() {
|
||||
setting.AppVer = APP_VER
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -34,7 +34,7 @@ func NewMessageFrom(to []string, from, subject, htmlBody string) *Message {
|
|||
msg := gomail.NewMessage()
|
||||
msg.SetHeader("From", from)
|
||||
msg.SetHeader("To", to...)
|
||||
msg.SetHeader("Subject", subject)
|
||||
msg.SetHeader("Subject", setting.MailService.SubjectPrefix+subject)
|
||||
msg.SetDateHeader("Date", time.Now())
|
||||
|
||||
contentType := "text/html"
|
||||
|
|
|
@ -821,7 +821,7 @@ func newSessionService() {
|
|||
// Mailer represents mail service.
|
||||
type Mailer struct {
|
||||
QueueLength int
|
||||
Subject string
|
||||
SubjectPrefix string
|
||||
Host string
|
||||
From string
|
||||
FromEmail string
|
||||
|
@ -848,7 +848,7 @@ func newMailService() {
|
|||
|
||||
MailService = &Mailer{
|
||||
QueueLength: sec.Key("SEND_BUFFER_LEN").MustInt(100),
|
||||
Subject: sec.Key("SUBJECT").MustString(AppName),
|
||||
SubjectPrefix: sec.Key("SUBJECT_PREFIX").MustString("[" + AppName + "] "),
|
||||
Host: sec.Key("HOST").String(),
|
||||
User: sec.Key("USER").String(),
|
||||
Passwd: sec.Key("PASSWD").String(),
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.11.42.0330
|
||||
0.11.43.0330
|
|
@ -190,8 +190,8 @@
|
|||
<dt>{{.i18n.Tr "admin.config.mailer_enabled"}}</dt>
|
||||
<dd><i class="fa fa{{if .MailerEnabled}}-check{{end}}-square-o"></i></dd>
|
||||
{{if .MailerEnabled}}
|
||||
<dt>{{.i18n.Tr "admin.config.mailer_name"}}</dt>
|
||||
<dd>{{.Mailer.Subject}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.config.mailer_subject_prefix"}}</dt>
|
||||
<dd><code>{{.Mailer.SubjectPrefix}}</code></dd>
|
||||
<dt>{{.i18n.Tr "admin.config.mailer_disable_helo"}}</dt>
|
||||
<dd><i class="fa fa{{if .Mailer.DisableHelo}}-check{{end}}-square-o"></i></dd>
|
||||
<dt>{{.i18n.Tr "admin.config.mailer_host"}}</dt>
|
||||
|
|
Loading…
Reference in New Issue