zoukankan      html  css  js  c++  java
  • lumisoft邮件头不规范造成内容无法读取

    解决邮件内容为multipart,并且Param_Boundary等于null的不规范邮件内容无法读取问题,这样的邮件内容头部往往带两个或多个ContentType。

    红色为自己加的,绿色为注释掉原来的。

    修改MIME_h_Collection.cs文件

    #region method GetFirst

    /// <summary>
    /// Gets first header field with the specified name. returns null if specified header field doesn't exist.
    /// </summary>
    /// <param name="name">Header field name.</param>
    /// <returns>Returns first header field with the specified name. returns null if specified header field doesn't exist.</returns>
    /// <exception cref="ArgumentNullException">Is raised when <b>name</b> is null reference.</exception>
    public MIME_h GetFirst(string name)
    {
    if(name == null){
    throw new ArgumentNullException("name");
    }
    List<MIME_h> rl= m_pFields.FindAll(x => x.Name == name);
    if (rl.Count > 0)
    {
    if (name != "Content-Type") return rl[0];
    foreach (MIME_h field in rl)
    {
    if (!(field is MIME_h_ContentType))
    {
    throw new ParseException("Header field 'ContentType' parsing failed.");
    }
    MIME_h_ContentType h = (MIME_h_ContentType)field;
    if (h.Type == "multipart" && h.Param_Boundary == null) continue;
    return field;
    }
    }
    //
    //foreach (MIME_h field in m_pFields.ToArray())
    //{
    // if (string.Equals(name, field.Name, StringComparison.InvariantCultureIgnoreCase))
    // {
    // return field;
    // }
    //}
    return null;
    }

    #endregion

  • 相关阅读:
    在客户端判断上传文件大小(不支持opera)
    javascript冒泡排序(javascript算法学习)
    提高js性能方法(让js只判断一次)
    ie8本地预览报错的解决
    负载均衡获取客户端IP
    遍历变量里面所有的属性
    HttpWebrequest的使用
    C#调用EnyimMemcached
    MySQL国内省市直辖区
    Log4Net使用
  • 原文地址:https://www.cnblogs.com/xueyuan299/p/6405952.html
Copyright © 2011-2022 走看看