improvements
This commit is contained in:
@@ -303,12 +303,15 @@ func extractMessageContent(body string) string {
|
||||
continue
|
||||
}
|
||||
textContent = buf.String()
|
||||
// Convert line endings to HTML breaks
|
||||
textContent = strings.ReplaceAll(textContent, "\n", "<br>\n")
|
||||
textContent = strings.ReplaceAll(textContent, "\r\n", "<br>\n")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if textContent != "" {
|
||||
return strings.TrimSpace(textContent)
|
||||
return textContent // Remove TrimSpace to preserve formatting
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,16 +322,28 @@ func extractMessageContent(body string) string {
|
||||
return fallbackExtractContent(body)
|
||||
}
|
||||
|
||||
return strings.TrimSpace(buf.String())
|
||||
content := buf.String()
|
||||
// Convert line endings to HTML breaks
|
||||
content = strings.ReplaceAll(content, "\r\n", "<br>\n")
|
||||
content = strings.ReplaceAll(content, "\n", "<br>\n")
|
||||
return content // Remove TrimSpace to preserve formatting
|
||||
}
|
||||
|
||||
// fallbackExtractContent is the previous implementation used as fallback
|
||||
func fallbackExtractContent(body string) string {
|
||||
parts := strings.Split(body, "\r\n\r\n")
|
||||
if len(parts) > 1 {
|
||||
return strings.TrimSpace(strings.Join(parts[1:], "\r\n\r\n"))
|
||||
content := strings.Join(parts[1:], "\r\n\r\n")
|
||||
// Convert line endings to HTML breaks
|
||||
content = strings.ReplaceAll(content, "\r\n", "<br>\n")
|
||||
content = strings.ReplaceAll(content, "\n", "<br>\n")
|
||||
return content // Remove TrimSpace to preserve formatting
|
||||
}
|
||||
return strings.TrimSpace(body)
|
||||
content := body
|
||||
// Convert line endings to HTML breaks
|
||||
content = strings.ReplaceAll(content, "\r\n", "<br>\n")
|
||||
content = strings.ReplaceAll(content, "\n", "<br>\n")
|
||||
return content // Remove TrimSpace to preserve formatting
|
||||
}
|
||||
|
||||
func (ic *IMAPClient) MarkAsProcessed(email Email) error {
|
||||
|
||||
Reference in New Issue
Block a user