Announcement

Collapse
No announcement yet.

Access to mail header field in the mail folder list

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Access to mail header field in the mail folder list

    Hi,

    I would like to get access to an arbitrary mail header when building the mail folder overview. The mails will contain an additional header denoting them to be verified ( e.g. 'contains a valid DKIM signature' ). The ajax api offers access to a limited set of headers (just the lucky ones having a number assigned). Is there a way to access the other headers without applying for a number ?

    Thanks in advance,

    Andreas
    Last edited by andreask; 08-22-2011, 06:05 PM.

  • #2
    See "Get a list of mails" in the HTTP API. It has a parameter "headers".

    If you want to add an icon to existing mail lists, then you're lucky that we've already needed to hack this before. Although it's a not supported API, you can try the following:
    Code:
    if (temporary.lists.mail) {
        temporary.lists.mail.addIcon({
            name: ["headers/X-my-header"],
            width: "16px",
            isVisible: function(mail) {
                return Boolean(mail.headers && mail.headers["X-my-header"]);
            },
            getIcon: function(mail) {
                switch (mail.headers["X-my-header"]) {
                    case "specialValue":
                        return "/plugins/com.example.myplugin/images/special.png";
                    default:
                        return "img/dummy.gif";
                }
            }
        });
    }

    Comment


    • #3
      Thanks Viktor,

      the headers parameter works well !

      But I'm a bit stuck with extending the js functionality. What type of event I should register for ? Got no idea which event marks the rendering of the mail list.

      And, where to put the snippet you supplied ? In mail.js ?

      Greetings

      Andreas

      Comment


      • #4
        It's for a plugin (using the Plugin API).

        Comment

        Working...
        X