Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression] TF-2215 Communicating l10n to remote servers #2343

Merged

Conversation

dab246
Copy link
Member

@dab246 dab246 commented Nov 20, 2023

@dab246
Copy link
Member Author

dab246 commented Nov 20, 2023

@chibenwa I have set the Accept-Language and Content-Language header for htmlBody before sending the email. But when I download the email as a .eml file and view it, I cannot find these two parameters Accept-Language and Content-Language. What is the problem here? Did I do something wrong somewhere? eml file below:

L10n communicating test.eml.zip

Copy link

This PR has been deployed to https://linagora.github.io/tmail-flutter/2343.

@chibenwa
Copy link
Member

Please set the Accept-Language and Content-Language header of the all email, not just individual parts.

@dab246
Copy link
Member Author

dab246 commented Nov 20, 2023

Please set the Accept-Language and Content-Language header of the all email, not just individual parts.

I get an invalidArgument error when I try to set Content-Language to Email. As the jmap documentation describes, we cannot set it up.

Screenshot 2023-11-20 at 14 14 38

@chibenwa
Copy link
Member

Ah ok I wasn't aware.

Please then share the requests you try to do.

@dab246
Copy link
Member Author

dab246 commented Nov 20, 2023

Ah ok I wasn't aware.

Please then share the requests you try to do.

Please see below:

Request

{
  "using": [
    "urn:ietf:params:jmap:submission",
    "urn:ietf:params:jmap:mail",
    "urn:ietf:params:jmap:core"
  ],
  "methodCalls": [
    [
      "Email/set",
      {
        "accountId": "{{accountId}}",
        "create": {
          "e01": {
            "mailboxIds": {
              "d5650690-8539-11eb-acad-a3d8fb60fff0": true
            },
            "subject": "[POSTMAN] Sent email support accept-language & content-language",
            "from": [
              {
                "name": "{{username}}",
                "email": "{{username}}"
              }
            ],
            "to": [
              {
                "name": "tdvu",
                "email": "{{username}}"
              }
            ],
            "htmlBody": [
              {
                "partId": "abc123",
                "type": "text/html"
              }
            ],
            "bodyValues": {
              "abc123": {
                "value": "Oke. Hello My name Dab",
                "isEncodingProblem": false,
                "isTruncated": false
              }
            },
            "header:User-Agent:asText": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36",
            "header:Accept-Language:asText": "fr-FR, en-US, vi-VN, ru-RU, ar-TN, it-IT",
            "header:Content-Language:asText": "en-US"
          }
        }
      },
      "c1"
    ],
    [
      "EmailSubmission/set",
      {
        "accountId": "{{accountId}}",
        "create": {
          "a1234": {
            "emailId": "#e01",
            "identityId": "578f5b94-ed52-4966-ad52-f79968a58d22",
            "envelope": {
              "mailFrom": {
                "email": "{{username}}"
              },
              "rcptTo": [
                {
                  "email": "{{username}}"
                }
              ]
            }
          }
        },
        "onSuccessUpdateEmail": {
          "#a1234": {
            "mailboxIds/d5650690-8539-11eb-acad-a3d8fb60fff0": null,
            "mailboxIds/d56aabe0-8539-11eb-acad-a3d8fb60fff0": true,
            "keywords/$seen": true,
            "keywords/$drafts": null
          }
        }
      },
      "c2"
    ]
  ]
}

Response

{
    "sessionState": "2c9f1b12-b35a-43e6-9af2-0106fb53a943",
    "methodResponses": [
        [
            "Email/set",
            {
                "accountId": "{{accountId}}}",
                "oldState": "31902e00-8775-11ee-944c-a76bab7b254d",
                "newState": "31902e00-8775-11ee-944c-a76bab7b254d",
                "notCreated": {
                    "e01": {
                        "type": "invalidArguments",
                        "description": "Header fields beginning with `Content-` MUST NOT be specified on the Email object, only on EmailBodyPart objects."
                    }
                }
            },
            "c1"
        ],
        [
            "EmailSubmission/set",
            {
                "accountId": "{{accountId}}}",
                "newState": "2c9f1b12-b35a-43e6-9af2-0106fb53a943",
                "notCreated": {
                    "a1234": {
                        "type": "invalidArguments",
                        "description": "'/emailId' property is not valid: Invalid messageId: Invalid UUID string: #e01"
                    }
                }
            },
            "c2"
        ],
        [
            "error",
            {
                "type": "invalidArguments",
                "description": "EmailSubmissionCreationId(#a1234) cannot be referenced in current method call"
            },
            "c2"
        ]
    ]
}

@chibenwa
Copy link
Member

No I meant: the one setting those headers on body parts...

@dab246
Copy link
Member Author

dab246 commented Nov 20, 2023

No I meant: the one setting those headers on body parts...

Oh, Please see on video demo.

Screenshot 2023-11-20 at 14 57 52

@dab246
Copy link
Member Author

dab246 commented Nov 20, 2023

Request

{
    "using": [
        "urn:ietf:params:jmap:submission",
        "urn:ietf:params:jmap:mail",
        "urn:ietf:params:jmap:core"
    ],
    "methodCalls": [
        [
            "Email/set",
            {
                "accountId": "{{accountId}}",
                "create": {
                    "e01": {
                        "mailboxIds": {
                            "d5650690-8539-11eb-acad-a3d8fb60fff0": true
                        },
                        "subject": "[POSTMAN] Sent email support accept-language & content-language 2",
                        "from": [
                            {
                                "name": "{{username}}",
                                "email": "{{username}}"
                            }
                        ],
                        "to": [
                            {
                                "name": "tdvu",
                                "email": "{{username}}"
                            }
                        ],
                        "htmlBody": [
                            {
                                "partId": "abc123",
                                "type": "text/html",
                                "header:Accept-Language": "fr-FR, en-US, vi-VN, ru-RU, ar-TN, it-IT",
                                "header:Content-Language": "en-US"
                            }
                        ],
                        "bodyValues": {
                            "abc123": {
                                "value": "Oke. Hello My name Dab",
                                "isEncodingProblem": false,
                                "isTruncated": false
                            }
                        },
                        "header:User-Agent:asText": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
                    }
                }
            },
            "c1"
        ],
        [
            "EmailSubmission/set",
            {
                "accountId": "{{accountId}}",
                "create": {
                    "a1234": {
                        "emailId": "#e01",
                        "identityId": "578f5b94-ed52-4966-ad52-f79968a58d22",
                        "envelope": {
                            "mailFrom": {
                                "email": "{{username}}"
                            },
                            "rcptTo": [
                                {
                                    "email": "{{username}}"
                                }
                            ]
                        }
                    }
                },
                "onSuccessUpdateEmail": {
                    "#a1234": {
                        "mailboxIds/d5650690-8539-11eb-acad-a3d8fb60fff0": null,
                        "mailboxIds/d56aabe0-8539-11eb-acad-a3d8fb60fff0": true,
                        "keywords/$seen": true,
                        "keywords/$drafts": null
                    }
                }
            },
            "c2"
        ]
    ]
}

Response

{
    "sessionState": "2c9f1b12-b35a-43e6-9af2-0106fb53a943",
    "methodResponses": [
        [
            "Email/set",
            {
                "accountId": "{{accountId}}",
                "oldState": "d183b160-877b-11ee-944c-a76bab7b254d",
                "newState": "d183b160-877b-11ee-944c-a76bab7b254d",
                "created": {
                    "e01": {
                        "id": "e7770c10-877b-11ee-944c-a76bab7b254d",
                        "blobId": "e7770c10-877b-11ee-944c-a76bab7b254d",
                        "threadId": "e7770c10-877b-11ee-944c-a76bab7b254d",
                        "size": 939
                    }
                }
            },
            "c1"
        ],
        [
            "EmailSubmission/set",
            {
                "accountId": "{{accountId}}",
                "newState": "2c9f1b12-b35a-43e6-9af2-0106fb53a943",
                "created": {
                    "a1234": {
                        "id": "0ff22157-4c89-4f66-a9d7-170b3e3993e4",
                        "sendAt": "2023-11-20T08:07:53Z"
                    }
                }
            },
            "c2"
        ],
        [
            "Email/set",
            {
                "accountId": "{{accountId}}",
                "oldState": "e79eb850-877b-11ee-944c-a76bab7b254d",
                "newState": "e7bf86c0-877b-11ee-944c-a76bab7b254d",
                "updated": {
                    "e7770c10-877b-11ee-944c-a76bab7b254d": null
                }
            },
            "c2"
        ]
    ]
}

@chibenwa
Copy link
Member

You are right, this was not implemented...

Adding it ASAP...

Issue: linagora/james-project#4944

PR: apache/james-project#1801

Thanks for the report ;-)

@dab246 dab246 force-pushed the bugfix/regression/tf-2215-communicating-l10n-to-remote-servers branch from d90bc21 to 9e3bf3f Compare January 15, 2024 07:37
…body parts in `jmap-dart-client` library

Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
@dab246 dab246 force-pushed the bugfix/regression/tf-2215-communicating-l10n-to-remote-servers branch from 9e3bf3f to b399e71 Compare January 15, 2024 07:55
@dab246 dab246 merged commit 752878f into master Jan 15, 2024
10 checks passed
@hoangdat hoangdat deleted the bugfix/regression/tf-2215-communicating-l10n-to-remote-servers branch February 20, 2024 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants