|
板凳
楼主 |
发表于 2016-4-9 17:59:46
|
只看该作者
跟踪下面smtp过程,问题应该不在smtp,而在imap
-
-
-
- XPCOMUtils.jsm
-
- defineLazyGetter: function XPCU_defineLazyGetter(aObject, aName, aLambda) // aName:'send'
- {
- Object.defineProperty(aObject, aName, {
- get: function () {
- delete aObject[aName];
- return aObject[aName] = aLambda.apply(aObject);
- },
- configurable: true,
- enumerable: true
- });
- },
-
-
-
- MailServices.js
-
- XPCOMUtils.defineLazyGetter(MailServices, 'send', function () {
- return Cu.import('resource://conversations/modules/stdlib/send.js', {})
- })
- src\app\conversations\modules\stdlib\send.js
- function sendMessage(aParams,
- { deliverType, compType },
- aBody,
- { progressListener, sendListener, stateListener },
- options) {
- let popOut = options && options.popOut; // false
- let fields = Cc["@mozilla.org/messengercompose/composefields;1"]
- .createInstance(Ci.nsIMsgCompFields);
- if ("cc" in aParams)
- fields.cc = aParams.cc;
- lds.fcc = defaultFcc;
- console.log('-------------compType',compType) //New 0 https://dxr.mozilla.org/comm-central/source/mailnews/compose/public/nsIMsgComposeParams.idl#16
-
-
- let params = Cc["@mozilla.org/messengercompose/composeparams;1"]
- .createInstance(Ci.nsIMsgComposeParams);
- params.composeFields = fields;
- params.identity = identity;
- params.type = compType;
- params.sendListener = sendListener;
- let msgHdr = hdrs[0];
- if(msgHdr && msgHdr.folder != null) {
- params.origMsgHdr = msgHdr;
- params.originalMsgURI = msgHdrGetUri(msgHdr);
- }
- fields.characterSet = "UTF-8";
- fields.body = body;
- gMsgCompose.SendMsg(deliverType, identity, identity.key, options && options.msgWindow, progress);
- }
- \mailnews\compose\src\nsMsgCompose.cpp
- NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *identity, const char *accountKey, nsIMsgWindow *aMsgWindow, nsIMsgProgress *progress)
- {
- rv = _SendMsg(deliverMode, identity, accountKey);
- }
- nsresult nsMsgCompose::_SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *identity,
- const char *accountKey)
- {
- rv = mMsgSend->CreateAndSendMessage(
- m_composeHTML ? m_editor.get() : nullptr,
- identity,
- accountKey,
- m_compFields,
- false,
- false,
- (nsMsgDeliverMode)deliverMode,
- nullptr,
- m_composeHTML ? TEXT_HTML : TEXT_PLAIN,
- bodyString,
- nullptr,
- nullptr,
- m_window,
- mProgress,
- sendListener,
- mSmtpPassword.get(),
- mOriginalMsgURI,
- mType);
- }
- \mailnews\compose\src\nsMsgSend.cpp
- NS_IMETHODIMP
- nsMsgComposeAndSend::CreateAndSendMessage(
- nsIEditor *aEditor,
- nsIMsgIdentity *aUserIdentity,
- const char *aAccountKey,
- nsIMsgCompFields *fields,
- bool digest_p,
- bool dont_deliver_p,
- nsMsgDeliverMode mode,
- nsIMsgDBHdr *msgToReplace,
- const char *attachment1_type,
- const nsACString &attachment1_body,
- nsIArray *attachments,
- nsIArray *preloaded_attachments,
- nsIDOMWindow *parentWindow,
- nsIMsgProgress *progress,
- nsIMsgSendListener *aListener,
- const char *password,
- const nsACString &aOriginalMsgURI,
- MSG_ComposeType aType
- )
- {
- rv = Init(aUserIdentity, aAccountKey, (nsMsgCompFields *)fields, nullptr,
- digest_p, dont_deliver_p, mode, msgToReplace,
- attachment1_type, attachment1_body,
- attachments, preloaded_attachments,
- password, aOriginalMsgURI, aType);
- }
- nsresult
- nsMsgComposeAndSend::Init(
- nsIMsgIdentity *aUserIdentity,
- const char *aAccountKey,
- nsMsgCompFields *fields,
- nsIFile *sendFile,
- bool digest_p,
- bool dont_deliver_p,
- nsMsgDeliverMode mode,
- nsIMsgDBHdr *msgToReplace,
- const char *attachment1_type,
- const nsACString &attachment1_body,
- nsIArray *attachments,
- nsIArray *preloaded_attachments,
- const char *password,
- const nsACString &aOriginalMsgURI,
- MSG_ComposeType aType)
- {
- rv = InitCompositionFields(fields, aOriginalMsgURI, aType);
- if (sendFile)
- {
- mTempFile = sendFile;
- return NS_OK;
- }
- return HackAttachments(attachments, preloaded_attachments);
- }
- nsresult
- nsMsgComposeAndSend::HackAttachments(nsIArray *attachments,
- nsIArray *preloadedAttachments)
- {
- // If no attachments - finish now (this will call the done_callback).
- if (needToCallGatherMimeAttachments) //发送前什么时候生成的临时文件? nsemail.eml mTempFile C:\Users\hechengjin\AppData\Local\Temp\nsemail.html
- return GatherMimeAttachments();
- }
- nsMsgComposeAndSend::GatherMimeAttachments()
- {
- rv = nsMsgCreateTempFile("nsemail.html", getter_AddRefs(mHTMLFile));
- rv = nsMsgCreateTempFile("nsemail.eml", getter_AddRefs(mTempFile));
-
- //文件中内容 cc都没有问题
-
- }
复制代码 |
|