procedure sendmail (an,Text,Absender:
string) ;
Var ini:TIniFile;
begin
//-------CONFIG HOST-------
ini := TiniFile.Create ('
.\econfig.ini');
with ini
do
begin
Hauptform.IdSMTP1.Host:=ReadString('
E-Mail', '
SMTP','
') ;
//--------------------------
Hauptform.IdMessage1.Clear;
// Plain Text
{ with TIdText.Create(Form1.IdMessage1.MessageParts, nil) do
begin
ContentType := 'text/plain';
Body.Text := 'Das sieht der Text-Viewer Betrachter';
end; }
// HTML Part
{ with TIdText.Create(Form1.IdMessage1.MessageParts, nil) do
begin
ContentType := 'text/html';
Body.Text := Text;
end; }
Hauptform.IdMessage1.ContentType := '
text';
Hauptform.IdMessage1.Body.Text:=Text+#13+ReadString('
E-Mail','
Betreff','
');;
Hauptform.IdMessage1.From.Address :=ReadString('
E-Mail','
von','
');
Hauptform.IdMessage1.From.
Name := ReadString('
E-Mail','
Absender','
');
Hauptform.IdMessage1.Subject := ReadString('
E-Mail','
Betreff','
');
Hauptform.IdMessage1.Recipients.Add.Address := an;
ShowMessage(IntToStr(Hauptform.IdMessage1.MessageParts.Count));
Hauptform.IdSMTP1.Connect;
try
Hauptform.IdSMTP1.Send(Hauptform.IdMessage1);
finally
Hauptform.IdSMTP1.Disconnect;
end;
end;
ini.Free;
end;