Einzelnen Beitrag anzeigen

matrix68

Registriert seit: 29. Mai 2003
9 Beiträge
 
#1

Datei-Anhang versenden aber wie ???

  Alt 29. Mai 2003, 16:09
ich möchte mit hilfe von Indycomponente einen Datei-Anhang versenden.
Leider weis ich nicht genau wie das gehen soll
Code:
TIdAttachment.Create(IndyMessage.MessageParts, FFilename);
ist das einzige was ich hier gefunden habe.

hier die Codes von Email:
Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdBaseComponent, IdMessage, Mask, IdComponent,
  IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP, IdTCPServer,
  IdIMAP4Server, ExtCtrls;

type
  TForm1 = class(TForm)
    IdMessage1: TIdMessage;
    IdSMTP1: TIdSMTP;
    Edit1: TEdit;
    Edit2: TEdit;
    Memo1: TMemo;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Image1: TImage;
    Button1: TImage;
    Text1: TLabel;
    Button2: TImage;
    Text2: TLabel;
    Image2: TImage;
    Image3: TImage;
    Label1: TLabel;
    Label2: TLabel;
    Image4: TImage;
    Label3: TLabel;
    procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Image2Click(Sender: TObject);
    procedure Image3Click(Sender: TObject);
    procedure Image4Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
TForm(form1).perform(WM_SYSCOMMAND, $F012, 0);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
With IdMessage1 do
begin
From.Address := Edit3.Text;
From.Name := Edit4.Text;
Subject := Edit5.Text;
Sender.Address := Edit3.Text;
Sender.Name := Edit4.Text;
ReplyTo[0].Address := Edit3.Text;
ReplyTo[0].Name := Edit4.Text;
Recipients[0].Address := Edit1.Text;
Recipients[0].Name := Edit2.Text;
ReceiptRecipient.Address := Edit1.Text;
ReceiptRecipient.Name := Edit2.Text;
Body := Memo1.Lines;
End;
With IdSMTP1 do
begin
Username := 'xxx@hotmail.com';
Password := 'xxx';
Port := 25;
Connect;
Button2.Enabled := True;
Text2.Enabled := True;
Button1.Enabled := False;
Text1.Enabled := False;
IdSMTP1.Send(IdMessage1);
Disconnect;
ShowMessage('Message Sent!');
Button1.Enabled := True;
Text1.Enabled := True;
Text2.Enabled := False;
Button2.Enabled := False;
end;

end;


procedure TForm1.Button2Click(Sender: TObject);
begin
IdSMTP1.Disconnect;
Button1.Enabled := True;
Text1.Enabled := True;
Button2.Enabled := False;
Text2.Enabled := False;
end;

procedure TForm1.Image2Click(Sender: TObject);
begin
Application.Terminate;
end;

procedure TForm1.Image3Click(Sender: TObject);
begin
Application.Minimize;
end;

procedure TForm1.Image4Click(Sender: TObject);
begin
form2 := Tform2.Create(Self);
form2.ShowModal;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Image1.Free;
Image2.Free;
Image3.Free;
Image4.Free;
Button1.Free;
Button2.Free;
Form2.Free;
end;

end.
wie baue ich jetzt diese codes hier ein ?

mfg.

Matrix
  Mit Zitat antworten Zitat