Здравствуйте форумчане, вот есть код для отправки письма на мыло через компонент IdTCPClient, все отлично пашет, но хотелось бы дописать от кого пришло, тоесть чтоб в поле от кого был не маил а имя, как это сделать??? Вот код отправки: PHP: var ts: String; i: Integer; sBoundary: String; begin EnableControls(false); try IdTCPClient.Host:=edServer.Text; IdTCPClient.Port:=sedPort.Value; IdTCPClient.Connect; IdTCPClient.GetResponse([220]); LogAllIncoming; LogOutcoming('Отправка'); IdTCPClient.SendCmd('HELO StudForum.ru', 250); LogAllIncoming; if cbAuthetication.Checked then begin LogOutcoming('AUTH LOGIN'); IdTCPClient.SendCmd('AUTH LOGIN', 334); LogAllIncoming; ts:=MimeEncodeString(edLogin.Text); LogOutcoming(ts); IdTCPClient.SendCmd(ts, 334); LogAllIncoming; ts:=MimeEncodeString(edPassword.Text); LogOutcoming(ts); IdTCPClient.SendCmd(ts, 235); LogAllIncoming; end; LogOutcoming('MAIL FROM:<'+edRetAddress.Text+'>'); IdTCPClient.SendCmd('MAIL FROM:<'+edRetAddress.Text+'>', 250); LogAllIncoming; LogOutcoming('RCPT TO:<'+edTo.Text+'>'); IdTCPClient.SendCmd('RCPT TO:<'+edTo.Text+'>', [250, 251]); LogAllIncoming; LogOutcoming('DATA'); IdTCPClient.SendCmd('DATA', 354); LogAllIncoming; LogOutcoming('X-Mailer: Email advertising '); IdTCPClient.WriteLn('X-Mailer: Email advertising '); LogOutcoming('From: '+edRetAddress.Text); IdTCPClient.WriteLn('From: '+edRetAddress.Text); LogOutcoming('To: '+edTo.Text); IdTCPClient.WriteLn('To: '+edTo.Text); if lvAttachments.Items.Count > 0 then begin if checkbox3.Checked=true then begin LogOutcoming('MIME-Version: 1.0'#13#10'Content-Type: multipart/mixed; text/html; boundary="'+sBoundary+'"'); IdTCPClient.WriteLn('MIME-Version: 1.0'#13#10'Content-Type: multipart/mixed; text/html; boundary="'+sBoundary+'"'); end else begin sBoundary:='StudMailer_by_StudForum.RU'; LogOutcoming('MIME-Version: 1.0'#13#10'Content-Type: multipart/mixed; boundary="'+sBoundary+'"'); IdTCPClient.WriteLn('MIME-Version: 1.0'#13#10'Content-Type: multipart/mixed; boundary="'+sBoundary+'"'); end; end else begin if checkbox3.Checked=true then begin LogOutcoming('MIME-Version: 1.0'#13#10'Content-Type: text/html; charset=windows-1251'); IdTCPClient.WriteLn('MIME-Version: 1.0'#13#10'Content-Type: text/html; charset=windows-1251'); end else begin LogOutcoming('MIME-Version: 1.0'#13#10'Content-Type: text/plain; charset=windows-1251'); IdTCPClient.WriteLn('MIME-Version: 1.0'#13#10'Content-Type: text/plain; charset=windows-1251'); end; end; LogOutcoming('Subject: '+edSubj.Text+#13#10#13#10); IdTCPClient.WriteLn('Subject: '+edSubj.Text+#13#10); if lvAttachments.Items.Count > 0 then begin LogOutcoming('--'+sBoundary+#13#10#13#10); IdTCPClient.WriteLn('--'+sBoundary+#13#10); end; begin LogOutcoming(memText.Text); IdTCPClient.WriteLn(memText.Text); end; for i:=0 to lvAttachments.Items.Count-1 do begin LogOutcoming('--'+sBoundary); IdTCPClient.WriteLn('--'+sBoundary); LogOutcoming('Content-Type: application/octet-stream; name="'+lvAttachments.Items[i].Caption+'"'#13#10+ 'Content-Disposition: attachment; filename="'+lvAttachments.Items[i].Caption+'"'#13#10+ 'Content-Transfer-Encoding: base64'#13#10#13#10); IdTCPClient.WriteLn('Content-Type: application/octet-stream; name="'+lvAttachments.Items[i].Caption+'"'#13#10+ 'Content-Disposition: attachment; filename="'+lvAttachments.Items[i].Caption+'"'#13#10+ 'Content-Transfer-Encoding: base64'#13#10); ts:=MimeEncodeString(ReadFileIntoString(lvAttachments.Items[i].SubItems[0])); LogOutcoming(ts); IdTCPClient.WriteLn(ts); end; LogOutcoming('.'); IdTCPClient.SendCmd('.', 250); LogAllIncoming; LogOutcoming('QUIT'); IdTCPClient.WriteLn('QUIT'); finally IdTCPClient.Disconnect; EnableControls(true); end; end; Зарание спасибо
Точно не помню, но может быть так должно быть: Code: IdTCPClient.WriteLn('From: Имя отправителя <'+edRetAddress.Text+'>');