Board index » delphi » Problem with TidSMTP : socket error 10054
ilvi
![]() Delphi Developer |
Problem with TidSMTP : socket error 100542006-04-14 08:17:01 PM delphi41 Hi. I have small console program which send some text data from file (size of file approximately 13 KB). When i run this program on Comp1 in my network all work. When i run this program on Comp2 in the same newtork i have two different case : 1) If i send this data by TIdAttachment then all work normally. 2) If i send this daba through TidMessage.Body then mail don't send with socket error 10054. Comp2 have the same network settings as a Comp1. All needs port open. Plese, help find solution in case №2. P.S. sorry for my english. Text of program: uses SysUtils, IdSMTP, IdMessage, IdAntiFreeze; var iCount : integer; FRecepientAdress : String; //1 FFilePath : String; //2 FSMTPServer : String; //3 FSMTPPort : integer; //4 FAuthType : integer; //5 FSMTPAccount : String; //6 FSMTPLogin : String; //7 FSubject : String; //8 ClientSMTP : TIdSMTP; IdMsgSend : TidMessage; idAnti : TidAntiFreeze; begin iCount := ParamCount; if(iCount < 2) then begin WriteLN('Not enought param. Exit.'); Exit; end; FRecepientAdress := 'XXXX@XXXXX.COM'; FSMTPServer := 'smtp.domen.ru'; FSMTPPort := 25; FAuthType := 1; FSMTPAccount := 'name'; FSMTPLogin := 'password'; FFilePath := 'c:\temp\1.txt'; FSubject := 'subject'; FRecepientAdress := ParamStr(1); FFilePath := ParamStr(2); try idAnti := TIdAntiFreeze.Create(nil); ClientSMTP := TIdSMTP.Create(Nil); IdMsgSend := TIdMessage.Create(ClientSMTP); ClientSMTP.Host := FSMTPServer; ClientSMTP.Port := FSMTPPort; ClientSMTP.UserId := FSMTPAccount; ClientSMTP.Password := FSMTPLogin; if(FAuthType = 0) then ClientSMTP.AuthenticationType := atNone else ClientSMTP.AuthenticationType := atLogin; IdMsgSend.Body.Clear; IdMsgSend.From.Text := FSMTPAccount + '@domen.ru'; with IdMsgSend.Recipients.Add do begin Address := FRecepientAdress; Name := 'Some Name'; end; IdMsgSend.Subject := FSubject; IdMsgSend.ReceiptRecipient.Text := ''; IdMsgSend.Body.LoadFromFile(FFilePath); //TIdAttachment.Create(IdMsgSend.MessageParts, FFilePath); ClientSMTP.Connect; if ClientSMTP.Connected then begin ClientSMTP.Send(IdMsgSend); ClientSMTP.Disconnect; end; except WriteLN('Error.'); end; if(IdMsgSend <>nil) then IdMsgSend.Free; if(ClientSMTP <>nil) then ClientSMTP.Free; if(idAnti <>nil) then idAnti.Free; end. --- posted by geoForum on delphi.newswhat.com |