Commit 9a1e992
authored
Fix: Set Message-Id and Date headers on outgoing emails (#115)
* fix: set Message-Id and Date headers on outgoing emails
Emails sent via the MCP server are missing Message-Id and Date headers.
When using iCloud SMTP (and similar providers), these headers are assigned
server-side during delivery, but they don't appear in the copy saved to
the IMAP Sent folder via APPEND. This breaks email threading in clients
like Apple Mail, which build the References chain from the Sent folder
copy rather than the delivered message.
Generate Message-Id (via email.utils.make_msgid) and Date (via
email.utils.formatdate) headers on the message object before both
sending via SMTP and saving to the Sent folder, so the same values
appear in both copies.
* test: add tests for Message-Id and Date header generation
Cover header presence and domain extraction from the sender address,
and verify the same Message-Id and Date appear on both the SMTP-sent
message and the returned object used for IMAP Sent folder saving.1 parent c442e33 commit 9a1e992
File tree
2 files changed
+67
-0
lines changed- mcp_email_server/emails
- tests
2 files changed
+67
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
776 | 776 | | |
777 | 777 | | |
778 | 778 | | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
779 | 785 | | |
780 | 786 | | |
781 | 787 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
331 | 392 | | |
332 | 393 | | |
333 | 394 | | |
| |||
0 commit comments