procedure TForm1.Button1Click(Sender: TObject);
var
Adresses:
string;
begin
with IdMessage1
do
begin
Clear;
From.Address := Edit1.Text;
Adresses := Edit2.Text;
repeat
Recipients.Add.Address := copy(Adresses, 0, IfThen(Pos('
;', Adresses) > 0, Pos('
;', Adresses), Length(Adresses)));
Adresses := copy(Adresses, Pos('
;', Adresses) + 1, Length(Adresses));
until Pos('
;', Adresses) = 0;
Adresses := Edit3.Text;
repeat
BccList.Add.Address := copy(Adresses, 0, IfThen(Pos('
;', Adresses) > 0, Pos('
;', Adresses), Length(Adresses)));
Adresses := copy(Adresses, Pos('
;', Adresses) + 1, Length(Adresses));
until Pos('
;', Adresses) = 0;
ContentType := '
text/' + IfThen(RadioButton1.Checked, '
plain', '
html');
Body := Memo1.Lines;
Sender := From;
Subject := Edit4.Text;
case ComboBox1.ItemIndex
of
0: Priority := mpHighest;
1: Priority := mpHigh;
2: Priority := mpNormal;
3: Priority := mpLow;
4: Priority := mpLowest;
end;
GenerateHeader;
end;
IdSMTP1.MailAgent := IfThen(Edit5.Text = '
', '
mySMTP', Edit5.Text);
IdSMTP1.Connect;
IdSMTP1.Authenticate;
IdSMTP1.Send(IdMessage1);
IdSMTP1.Disconnect;
end;