我正在構建一個Thunderbird擴展程序,並希望將我自己的標題添加到所有外發電子郵件(例如< myext-version:1.0 >)。任何想法如何做到這一點?我知道這是可能的,因爲這是在OpenPGP Enigmail擴展中完成的。謝謝!如何用Thunderbird擴展插入電子郵件標題?
7
A
回答
1
我不知道答案,但只是一些想法...
我認爲雷鳥擴展通常只是XUL和js。從的enigmail網站:
不像大多數的Mozilla插件,Enigmail中 包含平臺相關的部分:它 取決於CPU,編譯器,操作系統的 庫和 的電子郵件應用程序應當 融入。
望着Enigmail中的源代碼,this might be the relevant section(用C++)
所以,你可能需要或者翻譯他們做了什麼到JS(!),或不停地尋找不同的例子。
3
這裏是一個擴展我的工作代碼:
function SendObserver() {
this.register();
}
SendObserver.prototype = {
observe: function(subject, topic, data) {
/* thunderbird sends a notification even when it's only saving the message as a draft.
* We examine the caller chain to check for valid send notifications
*/
var f = this.observe;
while (f) {
if(/Save/.test(f.name)) {
print("Ignoring send notification because we're probably autosaving or saving as a draft/template");
return;
}
f = f.caller;
}
// add your headers here, separated by \r\n
subject.gMsgCompose.compFields.otherRandomHeaders += "x-test: test\r\n";
}
},
register: function() {
var observerService = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
observerService.addObserver(this, "mail:composeOnSend", false);
},
unregister: function() {
var observerService = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
observerService.removeObserver(this, "mail:composeOnSend");
}
};
/*
* Register observer for send events. Check for event target to ensure that the
* compose window is loaded/unloaded (and not the content of the editor).
*
* Unregister to prevent memory leaks (as per MDC documentation).
*/
var sendObserver;
window.addEventListener('load', function (e) {if (e.target == document) sendObserver = new SendObserver(); }, true);
window.addEventListener('unload', function (e) { if (e.target == document) sendObserver.unregister();}, true);
將這個由撰寫窗口(例如通過加載覆蓋chrome://messenger/content/messengercompose/messengercompose.xul)
.js文件裏面。
在我的情況下,SendObserver.observe中的檢查是必要的,因爲我想做一個用戶交互,但你可能會把它留在外面。
相關問題
- 1. Thunderbird的電子郵件Blast插件
- 2. Thunderbird中的HTML電子郵件問題
- 3. Thunderbird擴展入門
- 4. 電子郵件用戶擴展許可電子郵件
- 5. 用於電子郵件地址爬蟲的Thunderbird插件
- 6. 從Thunderbird中提取電子郵件地址電子郵件
- 7. 通過python訪問thunderbird電子郵件
- 8. 從Excel宏創建Thunderbird電子郵件
- 9. Mozilla Thunderbird API - 讀/寫電子郵件
- 10. 如何從擴展中打開Thunderbird中的郵件窗口?
- 11. 如何閱讀電子郵件標題?
- 12. 如何刪除電子郵件標題?
- 13. HTML表擴展在電子郵件
- 14. PHP電子郵件標題
- 15. php電子郵件標題
- 16. 電子郵件標題中
- 17. Thunderbird刪除任何擴展
- 18. 用C++開發Thunderbird擴展
- 19. Jenkins擴展電子郵件通知 - 電子郵件內容作爲附件
- 20. 禁用Thunderbird文件夾擴展
- 21. 在WordPress中擴展WP電子商務通知電子郵件
- 22. Facebook郵件在電子郵件客戶端Thunderbird
- 23. Thunderbird插件用於新郵件通知
- 24. 如何停止HTTP(和rfc822,電子郵件)標題注入?
- 25. 如何擴展異常以發送電子郵件
- 26. 如何更改Chrome擴展程序所有者電子郵件
- 27. Magento翻譯電子郵件 - 電子郵件標題
- 28. 電子郵件分類的電子郵件標題
- 29. jQuery的電子郵件的onclick與電子郵件標題
- 30. 如何從Outlook電子郵件中提取互聯網電子郵件標題?
這不屬於superuser.com嗎? – 2011-06-01 15:08:59