最近使用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还是那么多.

 

 

posted on 2010-01-14 13:11  garfieldtom  阅读(413)  评论(0编辑  收藏  举报