私はサンダーバードアドオンに取り組んでおり、ユーザーではなくアドオンによって書かれたメールを送信する必要があります。
私はそれでこれをやろうとしましたが、うまくいきません:
var am = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
var cf = Components.classes["@mozilla.org/messengercompose/composefields;1"].createInstance(Components.interfaces.nsIMsgCompFields);
cf.from = "somebody@somewhere.com";
cf.to = "somebodyelse@somewhere.com";
cf.subject = "test";
cf.body = "just a test\r\n";
var params = Components.classes["@mozilla.org/messengercompose/composeparams;1"].createInstance(Components.interfaces.nsIMsgComposeParams);
params.composeFields = cf;
var msgSend = Components.classes["@mozilla.org/messengercompose/send;1"].createInstance(Components.interfaces.nsIMsgSend);
var msgCompose = Components.classes["@mozilla.org/messengercompose/compose;1"].createInstance(Components.interfaces.nsIMsgCompose);
msgCompose.compFields = cf;
msgCompose.initialize(window,params); //[Exception... "Could not convert JavaScript argument arg 0 [nsIMsgCompose.initialize]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: *****" data: no]
msgCompose.SendMsg(msgSend.nsMsgDeliverNow, am.defaultAccount.defaultIdentity, am.defaultAccount.key, null, null);
誰でも私の間違いや簡単な方法を知っていますか?
ありがとう