Add SUBJECT_PREFIX mailer config option (#6605)
* Add SUBJECT_PREFIX mailer config option * Add space between subject prefix and subject (Change from Gogs) Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
84fd24246c
commit
827ab6b75a
4 changed files with 12 additions and 5 deletions
|
@ -38,7 +38,11 @@ func NewMessageFrom(to []string, fromDisplayName, fromAddress, subject, body str
|
|||
msg := gomail.NewMessage()
|
||||
msg.SetAddressHeader("From", fromAddress, fromDisplayName)
|
||||
msg.SetHeader("To", to...)
|
||||
msg.SetHeader("Subject", subject)
|
||||
if len(setting.MailService.SubjectPrefix) > 0 {
|
||||
msg.SetHeader("Subject", setting.MailService.SubjectPrefix+" "+subject)
|
||||
} else {
|
||||
msg.SetHeader("Subject", subject)
|
||||
}
|
||||
msg.SetDateHeader("Date", time.Now())
|
||||
msg.SetHeader("X-Auto-Response-Suppress", "All")
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ type Mailer struct {
|
|||
FromEmail string
|
||||
SendAsPlainText bool
|
||||
MailerType string
|
||||
SubjectPrefix string
|
||||
|
||||
// SMTP sender
|
||||
Host string
|
||||
|
@ -65,6 +66,7 @@ func newMailService() {
|
|||
CertFile: sec.Key("CERT_FILE").String(),
|
||||
KeyFile: sec.Key("KEY_FILE").String(),
|
||||
IsTLSEnabled: sec.Key("IS_TLS_ENABLED").MustBool(),
|
||||
SubjectPrefix: sec.Key("SUBJECT_PREFIX").MustString(""),
|
||||
|
||||
SendmailPath: sec.Key("SENDMAIL_PATH").MustString("sendmail"),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue