unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdTCPServer, IdSMTPServer, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP,
IdMessage, Mask, ExtCtrls;
type
TForm1 =
class
(TForm)
Button1: TButton;
IdSMTP1: TIdSMTP;
IdSMTPServer1: TIdSMTPServer;
Edit1: TEdit;
IdMessage1: TIdMessage;
Button2: TButton;
Label1: TLabel;
CheckBox1: TCheckBox;
Label2: TLabel;
Label3: TLabel;
ComboBox1: TComboBox;
Label4: TLabel;
Label5: TLabel;
Image1: TImage;
Memo1: TMemo;
procedure
Button1Click(Sender: TObject);
private
public
end
;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure
TForm1
.
Button1Click(Sender: TObject);
begin
IdSMTP1
.
Port:=
25
;
IdSMTP1
.
Host :=
'smtp.mail.ru'
;
IdSMTP1
.
AuthenticationType:=atLogin;
IdSMTP1
.
Username:=
'sdfsdfsdfsdf'
;
IdSMTP1
.
Password:=
'sdfsdfsdfsdf'
;
IdMessage1
.
Subject:=edit1
.
text;
IdMessage1
.
Recipients
.
EMailAddresses:=
'sdfsdfsdfsdf@mail.ru'
;
IdMessage1
.
From
.
Address:=
'sdfsdfsdfsdf@mail.ru'
;
IdMessage1
.
Body
.
Assign(Memo1
.
Lines);
try
try
IdSMTP1
.
Connect(
5000
);
IdSMTP1
.
Send(IdMessage1);
except
on
E:Exception
do
Memo1
.
Lines
.
Insert(
0
,
'ERROR: '
+ E
.
Message);
end
;
finally
if
IdSMTP1
.
Connected
then
IdSMTP1
.
Disconnect;
end
;
end
;
end
.