- 支持 465 隐式 TLS 与 587 STARTTLS,SMTP 配置优先、Postmark 备用 - 发件人支持 QQ 域名邮箱地址(z@kepo.net),凭证仅走环境变量 - HTTP 测试覆盖发送成功与认证失败;真实发信测试需显式开启 RUN_QQ_SMTP_LIVE_TEST Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
deb32f8fab
commit
c161d42b06
@@ -14,6 +14,7 @@ type Config struct {
|
||||
Stripe StripeConfig
|
||||
BinancePay BinancePayConfig
|
||||
Postmark PostmarkConfig
|
||||
SMTP SMTPConfig
|
||||
Commerce CommerceConfig
|
||||
Admin AdminConfig
|
||||
Wiki WikiConfig
|
||||
@@ -71,6 +72,20 @@ type PostmarkConfig struct {
|
||||
APIBaseURL string
|
||||
}
|
||||
|
||||
type SMTPConfig struct {
|
||||
Host string
|
||||
Port string
|
||||
Username string
|
||||
Password string
|
||||
FromEmail string
|
||||
TLSMode string
|
||||
TLSCAFile string
|
||||
}
|
||||
|
||||
func (c SMTPConfig) IsConfigured() bool {
|
||||
return c.Host != "" || c.Username != "" || c.Password != "" || c.FromEmail != ""
|
||||
}
|
||||
|
||||
type CommerceConfig struct {
|
||||
PublicBaseURL string
|
||||
WebAppURL string
|
||||
@@ -136,6 +151,15 @@ func Load() *Config {
|
||||
FromEmail: getEnv("POSTMARK_FROM_EMAIL", ""),
|
||||
APIBaseURL: getEnv("POSTMARK_API_BASE_URL", "https://api.postmarkapp.com"),
|
||||
},
|
||||
SMTP: SMTPConfig{
|
||||
Host: getEnv("SMTP_HOST", ""),
|
||||
Port: getEnv("SMTP_PORT", "465"),
|
||||
Username: getEnv("SMTP_USERNAME", ""),
|
||||
Password: getEnv("SMTP_PASSWORD", ""),
|
||||
FromEmail: getEnv("SMTP_FROM_EMAIL", ""),
|
||||
TLSMode: getEnv("SMTP_TLS_MODE", "implicit"),
|
||||
TLSCAFile: getEnv("SMTP_TLS_CA_FILE", ""),
|
||||
},
|
||||
Commerce: CommerceConfig{
|
||||
PublicBaseURL: getEnv("PUBLIC_BASE_URL", "http://localhost:8080"),
|
||||
WebAppURL: getEnv("WEB_APP_URL", "http://localhost:4260"),
|
||||
|
||||
Reference in New Issue
Block a user