Cartman. Posted June 27, 2014 Report Posted June 27, 2014 var Form2: TForm2;implementation{$R *.dfm}procedure TForm2.Button1Click(Sender: TObject);beginEdit2.Text:='email';Edit3.Text:='tara'; Memo1.Clear; Application.ProcessMessages; if IdTelnet1.Connected then IdTelnet1.Disconnect; //----------------------------------- IdTelnet1.Host:='mail.rambler.ru'; IdTelnet1.Port:=587; //----------------------------------- try IdTelnet1.Connect; IdTelnet1.WriteLn('HELO '+edit1.Text); IdTelnet1.WriteLn('AUTH LOGIN'); Sleep(200); IdTelnet1.WriteLn(IdEncoderMIME1.EncodeString(Edit2.Text)); //username Sleep(200); IdTelnet1.WriteLn(IdEncoderMIME1.EncodeString(Edit3.Text)); //password Sleep(100); IdTelnet1.WriteLn('MAIL FROM:'+edit1.Text); Sleep(50); IdTelnet1.WriteLn('RCPT TO:'+edit1.Text); Sleep(50); IdTelnet1.WriteLn('DATA'); Sleep(50); IdTelnet1.WriteLn('Subject:'+edit4.Text); Sleep(50); // IdTelnet1.WriteLn('DATA'); // Sleep(100); IdTelnet1.WriteLn(''); Sleep(50); IdTelnet1.Writeln(mmo1.Text); Sleep(50); IdTelnet1.WriteLn('.'); Sleep(50); IdTelnet1.Writeln('quit'); except IdTelnet1.Disconnect; end;end;procedure TForm2.IdTelnet1Status(ASender: TObject; const AStatus: TIdStatus; const AStatusText: String);begin stat1.Panels[0].Text:=AStatusText;end;procedure TForm2.IdTelnet1DataAvailable(Sender: TIdTelnet; const Buffer: String);begin Application.ProcessMessages; if Length(Trim(Buffer)) >0 then Memo1.Lines.Add(Buffer)end;procedure TForm2.FormDestroy(Sender: TObject);begintry if IdTelnet1.Connected thenIdTelnet1.Disconnect;finallyApplication.Terminate;end;end; private { Private declarations } {shift+ctrl+c} procedure sendmail(UserNme, password, host,from,_to,Subject,body: string; port: integer); public { Public declarations } end;var Form2: TForm2;implementation{$R *.dfm}procedure TForm2.IdTelnet1Status(ASender: TObject; const AStatus: TIdStatus; const AStatusText: String);begin stat1.Panels[0].Text:=AStatusText;end;procedure TForm2.IdTelnet1DataAvailable(Sender: TIdTelnet; const Buffer: String);begin Application.ProcessMessages; if Length(Trim(Buffer)) >0 then Memo1.Lines.Add(Buffer)end;procedure TForm2.FormDestroy(Sender: TObject);begintry if IdTelnet1.Connected thenIdTelnet1.Disconnect;finallyApplication.Terminate;end;end;procedure TForm2.sendmail(UserNme, password, host,from,_to,Subject,body: string; port: integer);begin Edit2.Text:=UserNme; Edit3.Text:=password; Memo1.Clear; Application.ProcessMessages; if IdTelnet1.Connected then IdTelnet1.Disconnect; IdTelnet1.Host:=host; IdTelnet1.Port:=port; try IdTelnet1.Connect; IdTelnet1.WriteLn('HELO '+edit1.Text); IdTelnet1.WriteLn('AUTH LOGIN'); Sleep(500); IdTelnet1.WriteLn(IdEncoderMIME1.EncodeString(UserNme)); //username IdTelnet1.WriteLn(IdEncoderMIME1.EncodeString(password)); //password Sleep(500); IdTelnet1.WriteLn('MAIL FROM:'+from); IdTelnet1.WriteLn('RCPT TO:'+_to); IdTelnet1.WriteLn('DATA'); IdTelnet1.WriteLn('Subject:'+Subject); IdTelnet1.WriteLn(''); IdTelnet1.Writeln(body); IdTelnet1.WriteLn('.'); IdTelnet1.Writeln('quit'); except IdTelnet1.Disconnect; end;end;procedure TForm2.Button1Click(Sender: TObject);beginsendmail('email', 'tara', 'mail.rambler.ru',Edit1.Text,Edit1.Text,Edit4.Text,Mmo1.Text ,587);end;end.And update Quote