diff options
| author | Bobby <[email protected]> | 2026-03-08 17:47:48 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-03-08 17:47:48 +0530 |
| commit | f48054e9bc5e4fb36b9aba9126c6ace9c5b1f470 (patch) | |
| tree | 0e993ddab1229ba7efccbb757987addb86effbe3 /utils/smtp | |
| parent | 2d5fb5e2078e92e7ec19582c3954409dd93f89fd (diff) | |
| download | dove-f48054e9bc5e4fb36b9aba9126c6ace9c5b1f470.tar.xz dove-f48054e9bc5e4fb36b9aba9126c6ace9c5b1f470.zip | |
feat(domains): enhance domain management UI with DNS records functionality
- Updated domain detail view to include DNS records management links.
- Added new DNS records creation form with dynamic fields based on record type.
- Implemented backend logic for creating and deleting DNS records.
- Introduced new services and messages for DNS operations.
- Refactored SMTP server initialization to streamline TLS configuration.
- Added email composition and submission utilities for better email handling.
Diffstat (limited to 'utils/smtp')
| -rw-r--r-- | utils/smtp/messages.go | 3 | ||||
| -rw-r--r-- | utils/smtp/server.go | 38 |
2 files changed, 22 insertions, 19 deletions
diff --git a/utils/smtp/messages.go b/utils/smtp/messages.go index 6441fde..1c82ab6 100644 --- a/utils/smtp/messages.go +++ b/utils/smtp/messages.go @@ -13,9 +13,6 @@ const ( NoLocalRecipients = "No local recipients found for message from %s." Recipient = "Recipient: %s" RecipientNotLocal = "Recipient %s is not a local mailbox." - RelayDeliveryFailed = "Failed to relay message to %s: %v" - RelayDeliverySuccess = "Relayed message to %s via %s:%d." - RelayDisabled = "Relay disabled. External recipient %s will not receive the message." ServerStarting = "%s listener started on %s." SessionStarted = "New session from %s." ShutdownComplete = "All listeners stopped." diff --git a/utils/smtp/server.go b/utils/smtp/server.go index 5260d20..0518ed7 100644 --- a/utils/smtp/server.go +++ b/utils/smtp/server.go @@ -18,28 +18,34 @@ type ServerInstance struct { var activeServers []ServerInstance func Start() { + var tlsConfig *tls.Config + if config.SMTP.TLSEnabled { + tlsConfig = loadTLSConfig() + } + plainAddress := fmt.Sprintf("%s:%d", config.SMTP.Host, config.SMTP.Port) plainServer := createServer(plainAddress) activeServers = append(activeServers, ServerInstance{Server: plainServer, Label: "SMTP"}) go startListener(plainServer, "SMTP", plainAddress) - if config.SMTP.TLSEnabled { - tlsConfig := loadTLSConfig() - if tlsConfig != nil { - smtpsAddress := fmt.Sprintf("%s:%d", config.SMTP.Host, config.SMTP.SMTPSPort) - smtpsServer := createServer(smtpsAddress) - smtpsServer.TLSConfig = tlsConfig - activeServers = append(activeServers, ServerInstance{Server: smtpsServer, Label: "SMTPS"}) - go startTLSListener(smtpsServer, "SMTPS", smtpsAddress) - - starttlsAddress := fmt.Sprintf("%s:%d", config.SMTP.Host, config.SMTP.StartTLSPort) - starttlsServer := createServer(starttlsAddress) - starttlsServer.TLSConfig = tlsConfig - starttlsServer.EnableSMTPUTF8 = true - activeServers = append(activeServers, ServerInstance{Server: starttlsServer, Label: "STARTTLS"}) - go startListener(starttlsServer, "STARTTLS", starttlsAddress) - } + smtpsAddress := fmt.Sprintf("%s:%d", config.SMTP.Host, config.SMTP.SMTPSPort) + smtpsServer := createServer(smtpsAddress) + activeServers = append(activeServers, ServerInstance{Server: smtpsServer, Label: "SMTPS"}) + if tlsConfig != nil { + smtpsServer.TLSConfig = tlsConfig + go startTLSListener(smtpsServer, "SMTPS", smtpsAddress) + } else { + go startListener(smtpsServer, "SMTPS", smtpsAddress) + } + + starttlsAddress := fmt.Sprintf("%s:%d", config.SMTP.Host, config.SMTP.StartTLSPort) + starttlsServer := createServer(starttlsAddress) + starttlsServer.EnableSMTPUTF8 = true + activeServers = append(activeServers, ServerInstance{Server: starttlsServer, Label: "STARTTLS"}) + if tlsConfig != nil { + starttlsServer.TLSConfig = tlsConfig } + go startListener(starttlsServer, "STARTTLS", starttlsAddress) } func Shutdown() { |
