feat: support ticket settings in OMC
This commit is contained in:
@@ -11,16 +11,16 @@ import (
|
||||
)
|
||||
|
||||
type EmailConfig struct {
|
||||
Enabled bool `yaml:"enabled"` // 是否启用邮件发送
|
||||
Host string `yaml:"host"`
|
||||
Port int `yaml:"port"`
|
||||
Username string `yaml:"username"`
|
||||
Password string `yaml:"password"`
|
||||
TLSSkipVerify bool `yaml:"tlsSkipVerify"`
|
||||
From string `yaml:"from"`
|
||||
To []string `yaml:"to"`
|
||||
Subject string `yaml:"subject"`
|
||||
Body string `yaml:"body"`
|
||||
Enabled bool `yaml:"enabled" json:"enabled"` // 是否启用邮件发送
|
||||
Host string `yaml:"host" json:"host"` // SMTP服务器地址
|
||||
Port int `yaml:"port" json:"port"` // SMTP服务器端口
|
||||
Username string `yaml:"username" json:"username"` // SMTP用户名
|
||||
Password string `yaml:"password" json:"password"` // SMTP密码
|
||||
TLSSkipVerify bool `yaml:"tlsSkipVerify" json:"tlsSkipVerify"` // 是否跳过TLS证书验证
|
||||
From string `yaml:"from" json:"from"` // 发件人邮箱地址
|
||||
To string `yaml:"to" json:"to"` // 收件人邮箱地址列表
|
||||
Subject string `yaml:"subject" json:"subject"` // 邮件主题
|
||||
Body string `yaml:"body" json:"body"` // 邮件正文内容
|
||||
}
|
||||
|
||||
// 简单邮件发送函数
|
||||
@@ -31,7 +31,7 @@ func SendEmail(email EmailConfig) error {
|
||||
username := email.Username
|
||||
from := email.From
|
||||
password := email.Password
|
||||
to := strings.Join(email.To, ",") // 将多个收件人用逗号连接
|
||||
to := email.To
|
||||
subject := email.Subject
|
||||
body := email.Body
|
||||
smtpHost := email.Host
|
||||
@@ -48,7 +48,7 @@ func SendEmail(email EmailConfig) error {
|
||||
func SendEmailWithGomail(email EmailConfig) error {
|
||||
m := gomail.NewMessage()
|
||||
m.SetHeader("From", email.From)
|
||||
m.SetHeader("To", email.To...)
|
||||
m.SetHeader("To", strings.Split(email.To, ",")...) // 支持多个收件人
|
||||
m.SetHeader("Subject", email.Subject)
|
||||
m.SetBody("text/plain", email.Body)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user