feat: Removed comments

This commit is contained in:
mrhid6 committed 2026-07-24 09:56:54 +01:00
1 parent 1a6cf03c03
commit e798365be2
27 files changed
+1557 -1714

No files matched your search

+2 -25
View File
@@ -15,8 +15,6 @@ import (
const timeout = 15 * time.Second
type Config struct {
Host string
Port string
@@ -41,19 +39,10 @@ func (c Config) Enabled() bool {
return c.Host != "" && c.From != "" && c.To != ""
}
func (c Config) Send(subject, body, replyTo string) error {
return c.sendTo(c.To, subject, body, replyTo)
}
func (c Config) sendTo(to, subject, body, replyTo string) error {
if !c.Enabled() {
return fmt.Errorf("smtp: not configured")
@@ -127,9 +116,6 @@ func recipients(to string) []string {
return out
}
func message(from, to, subject, body, replyTo string) []byte {
var b strings.Builder
b.WriteString("From: " + sanitizeHeader(from) + "\r\n")
@@ -137,10 +123,7 @@ func message(from, to, subject, body, replyTo string) []byte {
if replyTo != "" {
b.WriteString("Reply-To: " + sanitizeHeader(replyTo) + "\r\n")
}
b.WriteString("Date: " + time.Now().Format(time.RFC1123Z) + "\r\n")
b.WriteString("Message-ID: " + messageID(from) + "\r\n")
b.WriteString("Subject: " + mime.QEncoding.Encode("utf-8", sanitizeHeader(subject)) + "\r\n")
@@ -151,9 +134,6 @@ func message(from, to, subject, body, replyTo string) []byte {
return []byte(b.String())
}
func messageID(from string) string {
domain := "vantage.local"
if at := strings.LastIndex(from, "@"); at >= 0 && at < len(from)-1 {
@@ -170,9 +150,6 @@ func sanitizeHeader(v string) string {
return strings.NewReplacer("\r", " ", "\n", " ").Replace(v)
}
func (c Config) SendVerification(to, orgName, link string, ttl time.Duration) error {
body := fmt.Sprintf(`Confirm your email to finish creating %s on Vantage.
@@ -181,7 +158,7 @@ Open this link:
%s
The link works once and expires in %d hours. Until you use it, no account
exists — nothing has been created and the address is not registered.
exists nothing has been created and the address is not registered.
If you did not request this, ignore this email and nothing will happen.
`, orgName, link, int(ttl.Hours()))