fix: correct sender format issues fix #1347 - #2424
Conversation
- Adjust sender field format, add space to separate nickname and email address - Ensure email header format complies with standard RFC specifications - Fix potential email client sending exceptions (Tencent Cloud)
WalkthroughA minor formatting adjustment to the SMTP From header in the email module adds a space between the display name and email address, changing the format from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
common/email.go (1)
46-49: Security risk: TLS certificate verification is disabled.
InsecureSkipVerify: truedisables certificate validation, making SMTP connections vulnerable to man-in-the-middle attacks. This could expose credentials (SMTPToken) and email content.Consider applying this diff to enable proper certificate verification:
tlsConfig := &tls.Config{ - InsecureSkipVerify: true, ServerName: SMTPServer, }If certificate verification must be optional, make it configurable via an environment variable or configuration setting rather than hardcoding it to
true.
🧹 Nitpick comments (1)
common/email.go (1)
13-20: Optional: eliminate duplicate string split operation.
strings.Split(SMTPFrom, "@")is called twice—once on line 14 and again on line 18. Consider reusing thesplitvariable.Apply this diff to eliminate the duplication:
func generateMessageID() (string, error) { split := strings.Split(SMTPFrom, "@") if len(split) < 2 { return "", fmt.Errorf("invalid SMTP account") } - domain := strings.Split(SMTPFrom, "@")[1] + domain := split[1] return fmt.Sprintf("<%d.%s@%s>", time.Now().UnixNano(), GetRandomString(12), domain), nil }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
common/email.go(1 hunks)
🔇 Additional comments (1)
common/email.go (1)
35-35: Good fix for email header compatibility.Adding the space between the display name and angle-bracketed email address follows the more standard and readable form of RFC 5322-compliant email headers (Display Name email@address.com). While RFC 5322 allows optional whitespace here, the improved formatting should enhance compatibility with strict mail providers like Tencent Cloud and resolve the authentication issue reported in #1347.
fix: correct sender format issues fix QuantumNous#1347
fix: correct sender format issues fix QuantumNous#1347
Resolves #1347
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.