• Indy接收邮件可能会出现的一个Bug


    最近使用Indy做的系统接收邮件,以前一直没有问题,突然出现一个访问错误,追踪到源码,发现在IdMessage.pas中有这么一段代码:

    第860行处
      ......  

      // S.G. 27/1/2003: Only issue X-Priority header if priority <> mpNormal (for stoopid spam filters)
       if Priority <> mpNormal then begin

     ......

    而Priority是TIdMessage的一个属性:

    FPriority: TIdMessagePriority;

    ......

    property Priority: TIdMessagePriority read FPriority write FPriority default ID_MSG_PRIORITY;

    ...

    其中:

    TIdMessagePriority = (mpHighest, mpHigh, mpNormal, mpLow, mpLowest);

    ID_MSG_PRIORITY = mpNormal;

    可奇怪不知道为什么Priority属性在特定的邮件中会出现错误:

    (out of bound)-1

    不知道枚举类型有缺省值怎么会出现这种错误.只好用一种笨办法简单修改一下:

    ...  

    // S.G. 27/1/2003: Only issue X-Priority header if priority <> mpNormal (for stoopid spam filters)
        //by garfield,奇怪,怎么会出现Priority (out of bound) -1错误?
        if (Priority <> mpHighest) and (Priority <> mpHigh)  and (Priority <> mpNormal)  and (Priority <> mpLow)  and (Priority <> mpLowest) then
           Priority := mpNormal;

        if Priority <> mpNormal then begin

     ....

    不知道有没有大侠也遇到过这种情况.

    Indy,Bug还是那么多.

  • 相关阅读:
    CDM中添加Hive服务时Gateway是什么?
    ClouderaManager中Event Server报No such file or directory
    tail -f 与 tail -F的区别
    Zookeeper Canary
    Spark中hashshuffle与sortshuffle
    Spark streaming的执行流程
    Spark streaming的正确使用。。
    spark优化之并行度
    github 使用
    css 通用兄弟选择器( ~ )
  • 原文地址:https://www.cnblogs.com/GarfieldTom/p/1647688.html
Copyright © 2020-2023  润新知