unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,IdAntiFreeze, IdMessage, IdText,IdSmtp,
ComCtrls;
type
TForm1 =
class(TForm)
Edit1: TEdit;
Button1: TButton;
RichEdit1: TRichEdit;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
IdSmtp1: TIdSmtp;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Email: TIdMessage;
begin
IdSmtp1.AuthType := atDefault;
IdSmtp1.Username:='
mail@hotmail.de';
IdSmtp1.Password:='
PW';
IdSmtp1.Port:=25;
IdSmtp1.Host:='
smtp.hotmail.de';
Email := TIdMessage.Create(
nil);
Email.Recipients.Clear;
Email.Recipients.Add.Address := '
mail@hotmail.de';
//email des empfängers
Email.BccList.Add.Address := '
mail@hotmail.de';
//email des empfängers
Email.from.Text := edit1.text;
//Text der Email
Email.From.
Name := '
mail@hotmail.de';
//Name dem die Email gehört, also mein Name
Email.From.Address:='
mail@hotmail.de';
//Absender
Email.Subject:='
Test';
//Betreff
Email.Date := Now;
with TIdText.Create(email.MessageParts,
nil)
do
begin
Body.Text := RichEdit1.Text;
CharSet := '
iso-8859-1';
ContentTransfer := '
quoted-printable';
ContentType := '
text/html';
ParentPart := -1;
end;
idsmtp1.Connect;
try
IdSmtp1.Send(Email);
idsmtp1.Disconnect;
except
idsmtp1.Disconnect;
end;
showmessage('
Mail wurde verschickt');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
IdSmtp1 := TidSmtp.Create(self);
end;
end.