Hi Arno One other thing:
- The ICS code is running in a COM component that is running within a Server powered by RTC (realthinclient.com). - RTC does an awful lot of similar things to ICS (uses winsock etc), except that it does not have an SMTP component. - Is it possible that ICS and RTC are interferring with each other? Here's the code (event handlers, followed by the setup code): Thanks for helping by the way, I'm going out of my mind right now. procedure TGatewayPhoenix.handleSMTPRequestDone(asoSender: TObject; ausRqType: TSmtpRequest; aiError: Word); begin touch(); if obDebugLogging then begin if (aiError > 0) and (aiError < 10000) then osoModule.osoDebugLogger.DoDebugLog( asoSender, loDestFile, 'RequestDone Rq=' + IntToStr(Ord(ausRqType)) + ' Error='+ osoEmailWriter.ErrorMessage) else osoModule.osoDebugLogger.DoDebugLog( asoSender, loDestFile,'RequestDone Rq=' + IntToStr(Ord(ausRqType)) + ' Error='+ IntToStr(Error)); end; if (aiError > 0) and (aiError < 10000) then begin if (ousStatus<>gpErrorNoRetry) and (ousStatus<>gpErrorRetry) then begin // 400 series errors are supposedly non-fatal or 'intermittent' if (aiError>=400) and (aiError<500) then ousStatus := gpErrorRetry else ousStatus := gpErrorNoRetry; osAdditional := 'Request='+IntToStr(Ord(ausRqType)) + ' Error='+ osoEmailWriter.ErrorMessage + ' ' + oslastEmailAddress + ' ' + osLastTitle; abort(); exit; end; end; case ausRqType of smtpConnect: begin if osoEmailWriter.AuthType = smtpAuthNone then osoEmailWriter.Helo else osoEmailWriter.Ehlo; end; smtpHelo: osoEmailWriter.MailFrom; smtpEhlo: osoEmailWriter.Auth; smtpAuth: osoEmailWriter.MailFrom; smtpMailFrom: osoEmailWriter.RcptTo; smtpRcptTo: osoEmailWriter.Data; smtpData: begin ousStatus := gpSent; osoEmailWriter.Quit; end; smtpQuit: end; end; procedure TGatewayPhoenix.handleSmtpGetData(asoSender: TObject; aiLineNum: Integer; apMsgLine: Pointer; aiMaxLen: Integer; var abMore: Boolean); var lsLine, lsPart1, lsPart2: string; lbIsSplit: boolean; liMaxLen: integer; begin // This is an event called from the ics lib component to get the text of the // message. touch(); if aiLineNum > osoMessage.Count then begin abMore := FALSE; end else begin // Break the text into lines of reasonable length, wrapping // as appropriate liMaxLen := min(aiMaxLen, oiMaxLineChars); lsLine := osoMessage[aiLineNum - 1]; TSerioUtilities.splitLongString(lsLine, liMaxLen - 1, lbIsSplit, lsPart1, lsPart2); if lbIsSplit then begin StrPCopy(apMsgLine, lsPart1); osoMessage.Insert(aiLineNum, lsPart2); end else begin StrPCopy(apMsgLine, lsLine); end; end; end; procedure TGatewayPhoenix.handleSMTPHeaderLine(asoSender: TObject; apMsg: Pointer; aiSize: Integer); var lsAccountMsg: string; begin touch(); if StrLIComp(apMsg, 'From:', 5) = 0 then begin lsAccountMsg := #13#10 + 'Account code:' + osAccountCode; StrCat(apMsg, PChar(lsAccountMsg)); end; end; procedure TGatewayPhoenix.handleSMTPOnResponse(asoSender: TObject; asMsg: String); begin touch(); if obDebugLogging then begin osoModule.osoDebugLogger.DoDebugLog(asoSender, loDestFile, asMsg); end; end; procedure TGatewayPhoenix.init(const aiTimeoutSecs: integer; const asAccountCode: string; const auoOM: TObjectory; const aiThreadID: cardinal ); Const // Registry settings used to give control to change things under // direction for Serio support MAX_CHARS_PER_LINE = 80; REG_SMTP_SECTION = 'seg_smtp'; REG_CHARS_PER_LINE = 'chars_line'; var lsoReg: TRegIniFile; begin ouoOM := auoOM; oiThreadID := aiThreadID; osAccountCode := asAccountCode; ouoServiceConfig := TServiceConfig.Create(); ouoOM.addObject(ouoServiceConfig); ouoServiceConfig.init(auoOM); ouoServiceConfig.xsAccountCode := asAccountCode; osoEmailWriter := osoModule.osoEMailWriter; osoEmailWriter.OnCommand := handleSMTPOnCommand; osoEmailWriter.OnGetData := handleSmtpGetData; osoEmailWriter.OnHeaderLine := handleSMTPHeaderLine; osoEmailWriter.OnRequestDone := handleSMTPRequestDone; osoEmailWriter.OnResponse := handleSMTPOnResponse; osoEmailWriter.OnDisplay := handleSMTPOnDisplay; oiTimeoutSecs := aiTimeoutSecs; lsoReg := nil; try lsoReg := TRegIniFile.Create('Serio'); oiMaxLineChars := lsoReg.ReadInteger(REG_SMTP_SECTION, REG_CHARS_PER_LINE, MAX_CHARS_PER_LINE); oiMaxLineChars := max(oiMaxLineChars, 20); finally if lsoReg<>nil then lsoReg.free(); end; end; Here is a snipper from the thread message pump if initGateway() < 0 then begin Terminate(); exit; end; while terminated=FALSE do begin GetMessage( lssMsg, 0, 0, 0); if obInitialised then begin case lssMsg.message of EMAIL_GATEWAY_TICK: begin try case ouoGateway.xusStatus of gpReady: // ready to send processEmails(); // snipped .... // Snipped except on e1: exception do begin getSessionMgr(ouoOM).xuoConsole.addAlert('Email Gateway', TSvrRoot.loadString(1904) + ' : ' + e1.classname() + ' : ' + e1.Message, asHigh); // try resetting the email object ouoGateway.reset(); end; end; end; EMAIL_GATEWAY_QUIT: begin if ouoGateway.xusStatus=gpBusy then ouoGateway.reset(); Terminate(); exit; end; end; end; TranslateMessage(lssMsg); DispatchMessage(lssMsg); end; > No idea why this happens with your code, maybe in line 2456? ;-) > Please show us some code. > All I can say is that I have been using TSmtpCli V5 in a worker > thread with large and very large attachments over many years w/o > any problem of that kind (D4 and D7). > > -- > Arno Garrels > > > > -- > To unsubscribe or change your settings for TWSocket mailing list > please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket > Visit our website at http://www.overbyte.be _________________________________________________________________ Upgrade to Internet Explorer 8 Optimised for MSN. http://extras.uk.msn.com/internet-explorer-8/?ocid=T010MSN07A0716U -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be