mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-21 19:16:36 +08:00
Compare commits
1 Commits
27d8234af4
...
8f9ef5f4f8
Author | SHA1 | Date | |
---|---|---|---|
|
8f9ef5f4f8 |
@ -16,28 +16,20 @@ func shouldAuth() bool {
|
|||||||
return config.SMTPAccount != "" || config.SMTPToken != ""
|
return config.SMTPAccount != "" || config.SMTPToken != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// formatHeloName formats a string to be HELO compatible:
|
|
||||||
// - Converts to lowercase (for English compatibility)
|
|
||||||
// - Replaces spaces with hyphens
|
|
||||||
func formatHeloName(name string) string {
|
|
||||||
// Convert to lowercase and replace spaces with hyphens
|
|
||||||
return strings.ReplaceAll(strings.ToLower(name), " ", "-")
|
|
||||||
}
|
|
||||||
|
|
||||||
// getHeloName returns a HELO identifier combining system name and pod name
|
// getHeloName returns a HELO identifier combining system name and pod name
|
||||||
func getHeloName() string {
|
func getHeloName() string {
|
||||||
// Get pod name from environment (Kubernetes sets this automatically)
|
// Get pod name from environment (Kubernetes sets this automatically)
|
||||||
podName := os.Getenv("HOSTNAME")
|
podName := os.Getenv("HOSTNAME")
|
||||||
|
|
||||||
// Format the system name to be HELO compatible
|
// Create a HELO-compatible string (replace spaces with hyphens)
|
||||||
formattedName := formatHeloName(config.SystemName)
|
systemName := strings.ReplaceAll(config.SystemName, " ", "-")
|
||||||
|
|
||||||
if podName != "" {
|
if podName != "" {
|
||||||
return fmt.Sprintf("%s-%s", formattedName, podName)
|
return fmt.Sprintf("%s-%s", systemName, podName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback if not running in Kubernetes
|
// Fallback if not running in Kubernetes
|
||||||
return formattedName
|
return systemName
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendEmail sends an email with the given subject, receiver, and content
|
// SendEmail sends an email with the given subject, receiver, and content
|
||||||
|
Loading…
Reference in New Issue
Block a user