You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:Outlook签名含图片时自动添加注释JavaScript代码如何阻止

如何阻止Outlook在带图片的签名中自动插入MSO JavaScript代码?

当Outlook签名包含图片时,发送邮件会自动插入一段用于MSO注释显示的JavaScript代码,代码如下:

<script language="JavaScript"><!--
function msoCommentShow(anchor_id, com_id)
{
    if(msoBrowserCheck()) 
        {
        c = document.all(com_id);
        a = document.all(anchor_id);
        if (null != c && null == c.length && null != a && null == a.length)
            {
            var cw = c.offsetWidth;
            var ch = c.offsetHeight;
            var aw = a.offsetWidth;
            var ah = a.offsetHeight;
            var x  = a.offsetLeft;
            var y  = a.offsetTop;
            var el = a;
            while (el.tagName != "BODY") 
                {
                el = el.offsetParent;
                x = x + el.offsetLeft;
                y = y + el.offsetTop;
                }
            var bw = document.body.clientWidth;
            var bh = document.body.clientHeight;
            var bsl = document.body.scrollLeft;
            var bst = document.body.scrollTop;
            if (x + cw + ah / 2 > bw + bsl && x + aw - ah / 2 - cw >= bsl ) 
                { c.style.left = x + aw - ah / 2 - cw; }
            else 
                { c.style.left = x + ah / 2; }
            if (y + ch + ah / 2 > bh + bst && y + ah / 2 - ch >= bst ) 
                { c.style.top = y + ah / 2 - ch; }
            else 
                { c.style.top = y + ah / 2; }
            c.style.visibility = "visible";
}   }   }
function msoCommentHide(com_id) 
{
    if(msoBrowserCheck())
        {
        c = document.all(com_id);
        if (null != c && null == c.length)
        {
        c.style.visibility = "hidden";
        c.style.left = -1000;
        c.style.top = -1000;
        } } 
}
function msoBrowserCheck()
{
    ms = navigator.appVersion.indexOf("MSIE");
    vers = navigator.appVersion.substring(ms + 5, ms + 6);
    ie4 = (ms > 0) && (parseInt(vers) >= 4);
    return ie4;
}
if (msoBrowserCheck())
{
    document.styleSheets.dynCom.addRule(".msocomanchor","background: infobackground");
    document.styleSheets.dynCom.addRule(".msocomoff","display: none");
    document.styleSheets.dynCom.addRule(".msocomtxt","visibility: hidden");
    document.styleSheets.dynCom.addRule(".msocomtxt","position: absolute");
    document.styleSheets.dynCom.addRule(".msocomtxt","top: -1000");
    document.styleSheets.dynCom.addRule(".msocomtxt","left: -1000");
    document.styleSheets.dynCom.addRule(".msocomtxt","width: 33%");
    document.styleSheets.dynCom.addRule(".msocomtxt","background: infobackground");
    document.styleSheets.dynCom.addRule(".msocomtxt","color: infotext");
    document.styleSheets.dynCom.addRule(".msocomtxt","border-top: 1pt solid threedlightshadow");
    document.styleSheets.dynCom.addRule(".msocomtxt","border-right: 2pt solid threedshadow");
    document.styleSheets.dynCom.addRule(".msocomtxt","border-bottom: 2pt solid threedshadow");
    document.styleSheets.dynCom.addRule(".msocomtxt","border-left: 1pt solid threedlightshadow");
    document.styleSheets.dynCom.addRule(".msocomtxt","padding: 3pt 3pt 3pt 3pt");
    document.styleSheets.dynCom.addRule(".msocomtxt","z-index: 100");
}
// --></script>

以下是几种可行的阻止方法:

  • 手动编辑签名HTML文件并设置只读

    1. 打开签名存储路径:C:\Users\<你的用户名>\AppData\Roaming\Microsoft\Signatures
    2. 找到对应签名的.html文件,用记事本或代码编辑器打开
    3. 删除上述的<script>代码块,保存文件
    4. 右键该文件,选择属性,勾选只读,避免Outlook重新生成代码
  • 使用纯文本格式创建签名
    打开Outlook签名编辑器,选择纯文本格式制作签名。纯文本模式下不会生成富文本相关的MSO控件和JS代码,适合不需要复杂格式的场景。

  • 通过Word编辑签名并清理MSO代码

    1. 打开Word,制作包含图片的签名内容
    2. 点击文件→另存为,选择**网页(*.htm)**格式保存
    3. 用记事本打开保存的htm文件,删除其中的MSO相关JS代码和控件
    4. 将修改后的文件替换Outlook签名文件夹中的对应文件,并设置为只读
  • 禁用Word作为邮件编辑器(适用于新版本Outlook)

    1. 打开Outlook,点击文件→选项→邮件
    2. 在撰写邮件区域,取消勾选使用Microsoft Word编辑电子邮件
    3. 重启Outlook后重新创建签名,可避免生成这类MSO代码

内容的提问来源于stack exchange,提问作者Pozzo90

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 13:11:03