Conversation
|
/backport to stable5.7 |
There was a problem hiding this comment.
Pull request overview
This PR improves outbox troubleshooting by trying to persist the RFC822 “raw” message into mail_local_messages.raw even when SMTP/MIME sending fails, instead of only persisting raw on successful send.
Changes:
- Import
Throwableand use non-capturingcatch (Throwable)for consistency. - On non-retriable
Horde_Mime_Exception, attempt to store$mail->getRaw(false)into theLocalMessagebefore marking itSTATUS_ERROR. - Keep SMTP logout failures silent using the same
Throwableimport.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (in_array($e->getCode(), self::RETRIABLE_CODES, true)) { | ||
| $localMessage->setStatus(LocalMessage::STATUS_SMPT_SEND_FAIL); | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
The early return for retriable SMTP codes happens before the new best-effort raw capture, so messages ending up in STATUS_SMPT_SEND_FAIL still won't have raw stored for troubleshooting. If the intent is to “keep raw message on smtp/mime failure”, consider moving the raw-capture attempt before this return (or explicitly capturing raw for this status as well).
There was a problem hiding this comment.
I don't see the point of storing the raw message for a temporary issue by the remote. That's nothing we can fix / where having the raw message would help to troubleshoot.
| try { | ||
| $localMessage->setRaw($mail->getRaw(false)); | ||
| } catch (Throwable) { | ||
| // Having the raw message is nice for troubleshooting, but should not fail hard. | ||
| } | ||
| $localMessage->setStatus(LocalMessage::STATUS_ERROR); |
There was a problem hiding this comment.
New behavior now attempts to persist the raw RFC822 message when Horde_Mime_Exception occurs (non-retriable path), but there doesn't appear to be unit/integration coverage asserting that LocalMessage::getRaw() is populated (and that failures in getRaw(false) are tolerated). Adding a focused test would prevent regressions in this troubleshooting path.
True, but that also a different method I didn't even touch 🤷 bytestream/Mime#15 should help. |
Classic MessageMapper != MessageMapper 🤣 🙈 |
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
c72e0e9 to
b0aa093
Compare
I'm undecided about it.
The use case/steps to reproduce: