delphi - Indy SMTPServer send error message in OnConnect event -



delphi - Indy SMTPServer send error message in OnConnect event -

i'd send error message in smtpserver.onconnect event (and of course of study go straight ondisconnect event) client want gmail temporarily blocked ip message: 421, "4.7.0", our scheme has detected unusual rate of unsolicited mail service originating ip address. protect our users spam, mail service sent ip address has been temporarily blocked. review our mass email senders guidelines. how tried :

procedure tmainform.smtpserverconnect(acontext: tidcontext); var errmess : string; begin if iptemporarybanned(acontext.binding.peerip) begin acontext.connection.iohandler.writeln('421 ' + 'ip temporary banned.'); raise exception.create('ip temporary banned.'); end; end;

if utilize tidsmtp component there no problem - grab error in try .. except block, when utilize mail service client - mozilla thunderbird - cannot receive error message that's beingness sent - says 'the connection smtp server timed out.' how can send error mail service clients can read ?

you have no command on how clients handle errors server. client's responsibility detect errors server , deed accordingly, not obligated report server's error messages user, free whatever want. there nil can on server side. can send out error message, , hope clients @ to the lowest degree have logging capability user can hunt downwards error message if needed.

that beingness said, suggest include extended reply code in error message (just gmail does) clients recognize extended codes @ to the lowest degree know error temporary , security-related:

acontext.connection.iohandler.writeln('421 4.7.0 ip temporary banned.');

delphi email smtp indy

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -