unit SendUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, XPMan, ComCtrls, StdCtrls, IdMessage, IdTCPConnection,
IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase,
IdSMTP, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL,
IdBaseComponent, IdComponent, IdServerIOHandler, IdAntiFreezeBase,
IdAntiFreeze, Menus, IdIPWatch, IdVCard, IdUserPassProvider;
type
TSend =
class(TForm)
Send: TButton;
msg: TMemo;
ListBox1: TListBox;
IdSMTP1: TIdSMTP;
IdMessage1: TIdMessage;
IdAntiFreeze1: TIdAntiFreeze;
procedure SendClick(Sender: TObject);
procedure BackClick(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure CancelClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure smtpSendMailStatus(ASender: TObject;
const AStatus: TIdStatus;
const AStatusText:
String);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
procedure Status(AMsg:
string);
end;
var
Send: TSend;
implementation
uses
commctrl, OtherOptionsUnit, RegisterUnit;
{$R *.dfm}
procedure TSend.FormShow(Sender: TObject);
var
r: TRect;
begin
Msg.text := '
Hallo:' + #13#10 + Hallo.text;
end;
procedure TSend.SendClick(Sender: TObject);
var s :
string;
begin
Send.Enabled := False;
try
with idmessage1
do begin
Clear;
From.Text := Trim('
Bsp@bsp.de');
{Absender}
Recipients.Add.Text := Trim('
Hallo@Tschüß.de');
{Empfänger}
Subject := Trim('
Ich habe leider keinen Betreff');
{Betreff}
Body.Assign(msg.Lines);
{Hier kommt die Nachricht hinein}
end;
with IDSmtp1
do begin
Username := Trim('
Bsp');
Password := Trim('
BspPasswort');
Host := Trim('
BspHost');
Port := 25;
Connect;
try
Send(idmessage1);
finally Disconnect;
end;
end;
Status('
Completed');
finally Send.Enabled := True;
end;
s := '
Die Nachricht wurde an den EMpfänger versendet!';
ShowMessage(s);
close;
Application.terminate;
end;
procedure TSend.smtpSendMailStatus(ASender: TObject;
const AStatus: TIdStatus;
const AStatusText:
String);
begin
Status(AStatusText);
end;
procedure TSend.Status(AMsg:
string);
begin
ListBox1.ItemIndex := ListBox1.Items.Add(AMsg);
Application.ProcessMessages;
Application.ProcessMessages;
Application.ProcessMessages;
end;
end.