Firefox addon Mailto模板在以下情况下工作;“粘贴在urlbar中”;但不是在“之后”;注册并点击mailto链接;

Firefox addon Mailto模板在以下情况下工作;“粘贴在urlbar中”;但不是在“之后”;注册并点击mailto链接;,firefox-addon,Firefox Addon,这是最奇怪的事情。我有一个Hotmail/Live mail/Outlook邮件帐户。因此,开始撰写电子邮件的模板如下: http://mail.live.com/secure/start?action=compose&to=%s 我已经测试过添加Gmail处理程序模板https://mail.google.com/mail/?extsrc=mailto&url=%s使用下面的代码,然后单击mailto:链接,即可正常工作 复制: 请运行此代码,它将创建Outlook处理程序并将其设置为活动 /

这是最奇怪的事情。我有一个Hotmail/Live mail/Outlook邮件帐户。因此,开始撰写电子邮件的模板如下:

http://mail.live.com/secure/start?action=compose&to=%s

我已经测试过添加
Gmail处理程序模板https://mail.google.com/mail/?extsrc=mailto&url=%s
使用下面的代码,然后单击
mailto:
链接,即可正常工作

复制:

  • 请运行此代码,它将创建Outlook处理程序并将其设置为活动

    //start - create handler
    var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"].createInstance(Ci.nsIWebHandlerApp);
    handler.name = 'Outlook Live';
    handler.uriTemplate = 'http://mail.live.com/secure/start?action=compose&to=%s';
    //end - create handler
    
    //start - add handler
    var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].getService(Ci.nsIExternalProtocolService);
    var handlerInfo = eps.getProtocolHandlerInfo('mailto');
    handlerInfo.possibleApplicationHandlers.appendElement(handler, false);
    //end - add handler
    
    //start - set as active handler
    handlerInfo.preferredAction = Ci.nsIHandlerInfo.useHelperApp; //Ci.nsIHandlerInfo has keys: alwaysAsk:1, handleInternally:3, saveToDisk:0, useHelperApp:2, useSystemDefault:4
    handlerInfo.preferredApplicationHandler = handler;
    handlerInfo.alwaysAskBeforeHandling = false;
    //end - set as active handler
    
    var hs = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
    hs.store(handlerInfo);
    
  • 点击mailto链接。例如,我点击了我的插件页面上的“支持电子邮件”:链接是mailto:noitidart

  • 它在Hotmail中打开,但收件人是
    mailto:

  • 为什么第三步中的mailto不起作用


    如果您只是粘贴到url栏中:它可以正常加载。

    web协议处理程序将发送URI的完整
    .spec
    ,这意味着它将发送
    邮件到:abc@example.org
    只是
    abc@example.org

    显然,http live.com端点不能处理这个问题

    然而,令人震惊的是,https live.com端点确实处理了它,即
    https://mail.live.com/secure/start?action=compose&to=mailto:abc@org将从
    mailto:
    URI中提取正确的地址

    因此,将您的web协议模板URI更新为以下内容,您应该会没事(直到MS再次出错):


    哦,天哪,就这么多?哇,谢谢你,老兄,这些古怪的小虫子很难找到!
    https://mail.live.com/secure/start?action=compose&to=%s