2

I'm trying to get a custom message from the nsIMsgDBHdr interface.

let result = msgHdr.getProperty('x-custom');

But result is empty.

I tried to register headers in the preferences but this has no effect. Please help.

Vitaliy Demchuk
  • 180
  • 1
  • 1
  • 9

1 Answers1

2

Solved issue.

Components.utils.import("resource:///modules/Services.jsm");
let pref = "mailnews.customDBHeaders";
let chNames = ['x-custom', 'x-custom-2'];
// Save preferences.
Services.prefs.setCharPref(pref, chNames.join(" ").trim());

Get custom headers via nsIMsgDBHdr:

msgHdr.getStringProperty('x-custom');

Custom headers will appear only in new messages. In order that they appear in all the emails - it is necessary to re-index database.

Vitaliy Demchuk
  • 180
  • 1
  • 1
  • 9