Set up project files and add .gitignore to exclude local build/runtime artifacts. Made-with: Cursor
34 lines
875 B
Go
34 lines
875 B
Go
package email
|
|
|
|
import "carrot_bbs/internal/config"
|
|
|
|
// Config SMTP 邮件配置(由应用配置转换)
|
|
type Config struct {
|
|
Enabled bool
|
|
Host string
|
|
Port int
|
|
Username string
|
|
Password string
|
|
FromAddress string
|
|
FromName string
|
|
UseTLS bool
|
|
InsecureSkipVerify bool
|
|
TimeoutSeconds int
|
|
}
|
|
|
|
// ConfigFromAppConfig 从应用配置转换
|
|
func ConfigFromAppConfig(cfg *config.EmailConfig) Config {
|
|
return Config{
|
|
Enabled: cfg.Enabled,
|
|
Host: cfg.Host,
|
|
Port: cfg.Port,
|
|
Username: cfg.Username,
|
|
Password: cfg.Password,
|
|
FromAddress: cfg.FromAddress,
|
|
FromName: cfg.FromName,
|
|
UseTLS: cfg.UseTLS,
|
|
InsecureSkipVerify: cfg.InsecureSkipVerify,
|
|
TimeoutSeconds: cfg.Timeout,
|
|
}
|
|
}
|