cypht-org / cypht

Cypht: Lightweight Open Source webmail aggregator [PHP, JS]
http://cypht.org
GNU Lesser General Public License v2.1
949 stars 147 forks source link

[FIX] Stalwart: fix jmap 0.7.0 msg_header keys(message-id,message_id) #944

Closed Shadow243 closed 2 months ago

Shadow243 commented 2 months ago

Pull Request Description

Title: Update Draft Saving Functionality for Stalwart 0.7.0 Compatibility

Description:

Issue: In Stalwart release 0.5.0, the message ID field was consistently labeled as "message-id" in the response data when saving drafts. However, with the release of Stalwart 0.7.0, there has been a change where the message ID field is now labeled as "message_id". This inconsistency has caused issues when attempting to save drafts as our codebase was expecting the previous format.

Solution: To ensure compatibility with Stalwart 0.7.0 and future versions, this pull request updates the draft saving functionality to handle both "message-id" and "message_id" fields in the response data. The code now checks for the existence of both keys and compares their values accordingly. This change allows our application to seamlessly handle drafts saved using both versions of Stalwart.

Changes Made:

This pull request aims to resolve the compatibility issue with Stalwart 0.7.0 and improve the robustness of our draft saving feature for future releases.

    [0] => array(
        "uid" => "eaaaaaba",
        "flags" => "",
        "internal_date" => "2024-04-11T16:52:40Z",
        "size" => 609,
        "date" => "2024-04-11T16:52:38Z",
        "from" => "Steven NG <steven@lab14.evoludata.com>",
        "to" => "muhngesteven@gmail.com",
        "subject" => "Test Stalwart release 0.7.0",
        "content-type" => "",
        "timestamp" => 1712854360,
        "charset" => "",
        "x-priority" => "",
        "type" => "jmap",
        "references" => "",
        "message_id" => "52336d427c7dcbbcc5cbb3d57a485d12@Stevens-MacBook-Pro.local",
        "x_auto_bcc" => ""
    ),
    [1] => array(
        "uid" => "d2aaaaa3",
        "flags" => "",
        "internal_date" => "2024-04-11T16:52:03Z",
        "size" => 615,
        "date" => "2024-04-11T16:52:02Z",
        "from" => "Steven NG <steven@lab14.evoludata.com>",
        "to" => "muhngesteven@gmail.com",
        "subject" => "Test Stalwart release 0.7.0",
        "content-type" => "",
        "timestamp" => 1712854323,
        "charset" => "",
        "x-priority" => "",
        "type" => "jmap",
        "references" => "",
        "message_id" => "db0bd6557d9ae16ebce56259ba73fbd6@Stevens-MacBook-Pro.local",
        "x_auto_bcc" => ""
    ),
    [2] => array(
        // and so on for the remaining elements...
    ),
    // Remaining elements truncated for brevity
}

Related Issue: https://github.com/cypht-org/cypht/issues/931

Shadow243 commented 2 months ago

I'm getting a blank page(White page) after I click on Send Button. I'l add a commit about that to this PR.

Shadow243 commented 2 months ago

I'm getting a blank page(White page) after I click on Send Button. I'l add a commit about that to this PR.

I'm encountering the same error with Migadu.com, and it seems to be an issue not just with Stalwart but also with other services. I'll need to address this issue before proceeding, as I haven't been able to send mail with Stalwart due to this issue.

marclaporte commented 2 months ago

Spin off: https://github.com/cypht-org/cypht/issues/945

Shadow243 commented 2 months ago

We tested the 'send message' button with Yannick.Nsenga, and it's working on his side. However, the blank issue seems to occur only on my end. I'm wondering if it's related to my network. This can be merged once the conversation is resolved, but the issue https://github.com/cypht-org/cypht/issues/945 may require us to investigate why it's displaying a blank page on certain networks.