delphi - Indy SMTP server is refusing connection -
i @ beginning of new project, in area new me.
i want code application which act middle-man windows based email clients, such thunderbird, etc, , remote smtp server. reason being application perform slight manipulation of emails pass through.
so, figured want tidsmtpserver
. decided use port 6789, in case of possible conflict (which doubt, ... j.i.c).
i set smtp server's defaultport
6789, , bound smtp server 127.0.0.1:6789
in bindings
property (and, @sirrufo pointed out, set server.active true)..
now, added button test code, based on this question. change made change port smtp.port := 465;
smtp.port := idsmtpserver.defaultport
(host left 127.0.0.1
).
however, when attempt connect idsmtpserver
's idsmtpserverconnect()
method never called , exception, "eidsocketerror # 10061 connection refused".
any idea doing wrong?
(and there guide or tutorial describing use of idsmtpserver?)
there no problem connect tidsmtpserver
type tform1 = class( tform ) idsmtp1 : tidsmtp; idsmtpserver1 : tidsmtpserver; button1 : tbutton; listbox1 : tlistbox; procedure button1click( sender : tobject ); procedure idsmtpserver1connect( acontext : tidcontext ); procedure idsmtpserver1disconnect( acontext : tidcontext ); private procedure log( const amsg : string ); public { public-deklarationen } end; var form1 : tform1; implementation {$r *.dfm} procedure tform1.button1click( sender : tobject ); begin // server settings idsmtpserver1.defaultport := 6728; idsmtpserver1.onconnect := idsmtpserver1connect; idsmtpserver1.ondisconnect := idsmtpserver1disconnect; // client settings idsmtp1.host := '127.0.0.1'; idsmtp1.port := idsmtpserver1.defaultport; // connect client server idsmtpserver1.active := true; try idsmtp1.connect; idsmtp1.disconnect( true ); idsmtpserver1.active := false; end; end; procedure tform1.log( const amsg : string ); begin if mainthreadid = tthread.currentthread.threadid begin listbox1.itemindex := listbox1.items.add( amsg ); end else tthread.queue( nil, procedure begin log( amsg ) end ); end; procedure tform1.idsmtpserver1connect( acontext : tidcontext ); begin log( 'connect' ); end; procedure tform1.idsmtpserver1disconnect( acontext : tidcontext ); begin log( 'disconnect' ); end;
Comments
Post a Comment