Delphi XE3 indy gmail smtp -
i have problem sending gmail smtp mail indy on delphi xe3 build (version 17.0.4770.56661)
i can smooth send laptop other pc's give error "connection closed gracefully"
i add idlogfile component on form , give me line
recv 18.04.2013 11:17:20: 220 mx.google.com esmtp s47sm13947715eeg.8 - gsmtp<eol> sent 18.04.2013 11:17:20: ehlo s23-101<eol> recv 18.04.2013 11:17:20: 250-mx.google.com @ service, [195.175.87.xx]<eol>250-size 35882577<eol>250-8bitmime<eol>250-starttls<eol>250 enhancedstatuscodes<eol> sent 18.04.2013 11:17:20: starttls<eol> recv 18.04.2013 11:17:21: 220 2.0.0 ready start tls<eol> sent 18.04.2013 11:17:21: quit<eol>
and use code on app
idsmtp1.host:='smtp.gmail.com' ; idsmtp1.username:='umutscada@gmail.com'; idsmtp1.password:='xxxx'; idsmtp1.port:=587; idsmtp1.usetls:=utuseexplicittls; idssliohandlersocketopenssl1.ssloptions.mode := sslmclient; idssliohandlersocketopenssl1.ssloptions.method:= sslvtlsv1; idssliohandlersocketopenssl1.ssloptions.verifydepth := 2; idssliohandlersocketopenssl1.ssloptions.verifymode := []; idssliohandlersocketopenssl1.host := idsmtp1.host; idssliohandlersocketopenssl1.port := idsmtp1.port; idmessage1.from.address := 'umutscada@gmail.com'; idmessage1.cclist.emailaddresses:= edit5.text; idmessage1.subject:= 'subject here'; idmessage1.body.clear; idmessage1.body.add('body here'); z := 0 listbox8.items.count-1 begin tidattachmentfile.create(idmessage1.messageparts,listbox8.items[z]); end; idsmtp1.connect; idsmtp1.authenticate; try try idsmtp1.send(idmessage1); except on e:exception memo1.lines.insert(0, 'error: ' + e.message); end; if idsmtp1.connected idsmtp1.disconnect; end;
please me
thanks :)
when quit
command sent after starttls
response received, means exception raised during actual ssl/tls handshake. tidsmtp.connect()
catches exception, calls disconnect()
(sending unencrypted quit
since ssl/tls not active 1), , re-raises exception code. need check exception being raised. "connection closed gracefully" exception means connection closed on other end, either server itself, or maybe firewall/router sitting in middle of connection.
update:
1: tidsmtp
updated in svn rev 5156 in 2014 no longer send unencrypted quit
when closing socket due ssl/tls handshake failure, since socket in indeterminate state point.
Comments
Post a Comment