Clément 148 Posted December 27, 2022 Hi, I'm using ICS 8.68 and Delphi XE. This Windows Service checks for emails every minute, and send all emails that are found. The SMTP server is replying with 452 - 4.3.1 Insufficient system resources after a while. If my customer restart the service ( takes a little over a minute ), another batch of emails are sent without errors ( Same server, same port) Until I receive the error 452 again. From his point of view, my application has a problem, since a service restart solves the problem. From mine, the SMTP server, which might be shared with other applications, has some issues, either disk space or memory. The service does a lot of other things and all of them are working fine ( no errors in any log). Should I abort sending emails when this the SMTP server replies with this error? How can I trap it? TIA, Clément Share this post Link to post
Lajos Juhász 293 Posted December 27, 2022 Google returns that usually this error message occurs when the Exchange server is low on disk space. In any case you should incorporate a delay. Nowdays servers usually has a hard limit how many e-mails you can send in an hour. 1 Share this post Link to post
Angus Robertson 574 Posted December 28, 2022 Agree, essentially nothing to fix in ICS, it's a server issue, Google brings up a vast number of responses for the error in Exchange. Hard to tell if it's a real problem with the server being overwhelmed or artificial because it considers the email volume abusive. Restarting your service merely causes a delay in sending email so the server is content again. So you need to slow down the rate at which you send emails. Perhaps send one email per session, if you are sending multiple emails with one connection, Or just wait a second or two between emails, If you get an error sending email, close the session and start a new session. Much easier to test if you have access to the real server. Are you using the TIcsMailQueue component? It is designed for this sort of activity and will retry emails that fail on a schedule over many hours. But it does not currently have a means to so down flow to one server. It will use multiple servers if one gives an error. Angus 1 Share this post Link to post
Clément 148 Posted December 28, 2022 Sorry if I make it sound like was an ICS issue. It's an internal SMTP server ( I don't know which ). I ask their IT folks to help me with some information, but this time of the year emails must be sent, and since most IT fellows are in holidays.... Getting back to ICS, is there a "better" event to add some delay ( emails per hour throttle comes to my mind ) procedure TRNBWSMTP.SmtpRequestDone(Sender: TObject; RqType: TSmtpRequest; ErrorCode: Word); begin if not fDebugMode then Log(FSMTP.LastResponse); // This is where it logs the error 452 if (ErrorCode > 0) and (ErrorCode < 10000) then begin Log('RequestDone Rq=' + IntToStr(Ord(RqType)) + ' Error='+ FSMTP.ErrorMessage); if ErrorCode = 501 then begin FSuccess := false; FSMTP.Quit; exit; end; end; {...} end; Share this post Link to post
programmerdelphi2k 237 Posted December 28, 2022 (edited) I dont know like ICS works, but if you use a "var-Flag" to controls the time send.. like: Quote IF NoSendForWhilePleaseWaitAtime then Exit; ... the error appears on "LOG save"? then, not on "send" in fact? Edited December 28, 2022 by programmerdelphi2k Share this post Link to post
Angus Robertson 574 Posted December 28, 2022 ICS is mostly even driven, you never put delays in events since that upsets the protocol. So it's really down to how you queue your emails, delay sending them after an error, I mostly use triggers tested in a single once per second timer event, there are several functions in ICS for setting and checking triggers. Except for TIcsMailQueue which uses real date/times checked in a thread. How many emails (megs) are you sending each minute? It must be a lot to cause the mail server queue to run out of disk space continually. Angus Share this post Link to post
Clément 148 Posted December 28, 2022 21 minutes ago, Angus Robertson said: ICS is mostly even driven, you never put delays in events since that upsets the protocol. The routine is working fine, and I really don't want to upset the protocol. 22 minutes ago, Angus Robertson said: How many emails (megs) are you sending each minute? It must be a lot to cause the mail server queue to run out of disk space continually. I asked for this information. Unfortunately most IT folks are in holiday break. My best guess: this SMTP server is share among other applications. I'm placing a delay before the initial call to connect (or MailForm). Share this post Link to post