Commit c442e33
feat: Add HTML body fallback when text/plain is not available (#114)
* feat: Add HTML body fallback when text/plain is not available
Many email clients (Outlook, Gmail, etc.) send HTML-only emails without
a text/plain alternative. This causes get_emails_content to return empty
body fields.
This change:
- Collects text/html content as a fallback when parsing multipart emails
- Strips HTML tags to convert to readable text if no text/plain is found
- Handles single-part HTML emails the same way
Fixes #113
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* style: Use ternary operator per ruff SIM108
---------
Co-authored-by: Peter Tittmann <ptittmann@@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent a3c8424 commit c442e33
1 file changed
+40
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
155 | 175 | | |
156 | 176 | | |
157 | 177 | | |
| |||
162 | 182 | | |
163 | 183 | | |
164 | 184 | | |
165 | | - | |
| 185 | + | |
166 | 186 | | |
167 | 187 | | |
168 | 188 | | |
| |||
171 | 191 | | |
172 | 192 | | |
173 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
174 | 207 | | |
175 | | - | |
| 208 | + | |
| 209 | + | |
176 | 210 | | |
177 | 211 | | |
178 | 212 | | |
179 | 213 | | |
180 | | - | |
| 214 | + | |
181 | 215 | | |
182 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
183 | 219 | | |
184 | 220 | | |
185 | 221 | | |
| |||
0 commit comments