andris9 / hoodiecrow

Scriptable IMAP server for client integration testing
http://andris9.github.io/hoodiecrow/
Other
60 stars 27 forks source link

Mocking non-english gmail accounts #16

Closed epinzur closed 9 years ago

epinzur commented 9 years ago

This is more of a question on setup. Can you tell me what the proper mailbox config would be for testing a French gmail setup?

I've tried using something like this. (I realize this is a subset of the full setup of a gmail account)

plugins: ["SPECIAL-USE"],
  storage: {
    "INBOX":{},
    "": {
      "separator": "/",
      "folders": {
        "[Gmail]": {
          "flags": ["\\Noselect"],
          "folders": {
            "Tous les messages": {
              "special-use": "\\All"
            },
            "Messages envoyés": {
              "special-use": "\\Sent"
            },
            "Corbeille": {
              "special-use": "\\Trash"
            }
          }
        }
      }
    }
  },
debug: true
};

Should this work? Or should I instead use the utf-7-imap encoding for the Sent folder name: Messages envoy&AOk-s

When I do a folder list using node-imap (using Messages envoyés), I get this from the debug output of hoodiecrow:

A4 LIST "" "*"
SEND: * LIST (\HasNoChildren) "/" "INBOX"
SEND: * LIST (\Noselect \HasChildren) "/" "[Gmail]"
SEND: * LIST (\HasNoChildren \All) "/" "[Gmail]/Tous les messages"
SEND: * LIST (\HasNoChildren \Sent) "/" "[Gmail]/Messages envoyés"
SEND: * LIST (\HasNoChildren \Trash) "/" "[Gmail]/Corbeille"
SEND: A4 OK Completed

and this from the debug output of node-imap:

A4 LIST "" "*"
* LIST (\HasNoChildren) "/" "INBOX"
* LIST (\Noselect \HasChildren) "/" "[Gmail]"
* LIST (\HasNoChildren \All) "/" "[Gmail]/Tous les messages"
* LIST (\HasNoChildren \Sent) "/" "[Gmail]/Messages envoy�s"
* LIST (\HasNoChildren \Trash) "/" "[Gmail]/Corbeille"
A4 OK Completed

Any help is appreciated. Thanks.

andris9 commented 9 years ago

Use utf7 encoded strings as the values are not encoded automatically

andris9 commented 9 years ago

For a reference here's an example for an Estonian mail account:

{
    '[Gmail]': {
        flags: ['\\Noselect'],
        folders: {
            'K&APU-ik kirjad': {
                'special-use': '\\All'
            },
            Mustandid: {
                'special-use': '\\Drafts'
            },
            'T&AOQ-htis': {
                'special-use': '\\Important'
            },
            'Saadetud kirjad': {
                'special-use': '\\Sent'
            },
            'R&AOQ-mpspost': {
                'special-use': '\\Junk'
            },
            'T&AOQ-rniga': {
                'special-use': '\\Flagged'
            },
            'Pr&APw-gikast': {
                'special-use': '\\Trash'
            }
        }
    }
}

And when listing it via IMAP the output is the following

A LIST "" "*"
* LIST (\HasNoChildren) "/" "INBOX"
* LIST (\Noselect \HasChildren) "/" "[Gmail]"
* LIST (\HasNoChildren \All) "/" "[Gmail]/K&APU-ik kirjad"
* LIST (\HasNoChildren \Drafts) "/" "[Gmail]/Mustandid"
* LIST (\HasNoChildren \Important) "/" "[Gmail]/T&AOQ-htis"
* LIST (\HasNoChildren \Sent) "/" "[Gmail]/Saadetud kirjad"
* LIST (\HasNoChildren \Junk) "/" "[Gmail]/R&AOQ-mpspost"
* LIST (\HasNoChildren \Flagged) "/" "[Gmail]/T&AOQ-rniga"
* LIST (\HasNoChildren \Trash) "/" "[Gmail]/Pr&APw-gikast"
A OK Completed
epinzur commented 9 years ago

awesome, thanks!