diff --git a/mime.go b/mime.go
index 4970a8a..3143d83 100644
--- a/mime.go
+++ b/mime.go
@@ -210,49 +210,77 @@ func extractAttachmentParts(entity *message.Entity, attachments *[]Attachment) {
}
// stripHTML removes HTML tags and returns plain text
-func stripHTML(html string) string {
- var result strings.Builder
+func stripHTML(htmlContent string) string {
+ // Remove style and script blocks first
+ result := htmlContent
+
+ // Remove blocks
+ for {
+ start := strings.Index(strings.ToLower(result), "