Autor Beitrag
Juliman
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: Mo 04.10.04 17:31 
Hallo Leute!

Ich würde gerne den inhalt eines edit feldes auslesen und alle 5 minuten per email verschicken.

Ich muss also einen timer und einen indy smtp client/server benutzen oder?

Aber wie mache ich das??

Danke schon mal im Vorraus, Julian
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Mo 04.10.04 20:21 
Hallo,

IndySMTP ist schonmal richtig.

In den Faq wirst du finden wie man eine eMail versendet.
Der Rest ist standart.

Das Timerinterval musst du auf 5 Minuten einstellen (5 * 60 000ms).

Dein Timer wird nun alle 5 Minuten, das tun, was du in seinem onTimer-Ereigniss festgelegt hast.


So einfach ist das :)
Juliman Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: Di 05.10.04 13:51 
Das geht bei mir nicht.

DER SAGT BEI MIR:

[Hinweis] Unit1.pas(36): Variable 'nAlarmnr' wurde deklariert, aber in 'TForm1.SendEmail' nicht verwendet
[Fehler] Unit1.pas(73): Undefinierter Bezeichner: 'edit_empfaenger'
[Fehler] Unit1.pas(73): Nicht genügend wirkliche Parameter
[Fehler] Unit1.pas(18): Ungenügende Forward- oder External-Deklaration: 'TForm1.FormCreate'
[Fataler Fehler] Project1.dpr(5): Verwendete Unit 'Unit1.pas' kann nicht compiliert werden


Was soll ich machen??

Ich habe aber das eine editfeld so gennant: edit_empfaenger
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Di 05.10.04 13:53 
Hast du eine eigene Prozedur angelegt? Zeige bitte mal mehr Code, vielleicht die ganze Unit.

Cu,
Udontknow
Elite
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 05.10.04 14:19 
Das sieht nach ner völlig zerschossenen Unit aus. Wahrscheinlich n paar Prozeduren gelöscht und Komponenten umbenannt. Nix Wildes.
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Di 05.10.04 14:21 
Ich tippe auf reguläre Prozedur (also keine Methode von TForm1). :)
Juliman Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: Di 05.10.04 14:28 
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
unit mail;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    memo1: TMemo;
    Edit1: TEdit;
    Edit2: TEdit;
    IdMessage: TIdMessage;
    IdSMTP: TIdSMTP;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
    function SendEmail(Recipient:string;CCList:string;sSubject:string;Body:TStringList):boolean;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function tform1.SendEmail(Recipient:string;CCList:string;sSubject:string;Body:TStringList):boolean;
var
  nAlarmnr:integer;
begin
 idSMTP.Host   := 'smtp.puretec.de';
 idSMTP.UserName := 'sag ich net ;-)';
 idSMTP.Password := 'swordfish';
 idSMTP.Port   := 25;

 idMessage.From.text  :='mail@delphi-forum.de';
 idMessage.Sender.text:=idMessage.From.text;

 idMessage.Recipients.EMailAddresses:= Recipient;
 idMessage.CCList.EMailAddresses := CCList;
 idMessage.Subject:=sSubject;

 idMessage.Body.Clear;
 idMessage.Body := Body;

 try
   idSMTP.Connect;
   idSMTP.Send(idMessage);
   idSMTP.Disconnect;
   result:=True;
   except on E : Exception do
     begin
       if idSMTP.connected then try idSMTP.disconnect; except end;
       result := false;
     end;
 end;
end;



procedure TForm1.Button1Click(Sender: TObject);

var
  st: TStringList;
begin
  st := TStringList.Create;
  st.Text := memo1.Lines.Text;
  form1.SendEmail(edit_empfaenger.Text, '', edit_betreff.Text, st);
  st.Free;
end;

end.


Fehlermeldungen:

[Hinweis] mail.pas(35): Variable 'nAlarmnr' wurde deklariert, aber in 'TForm1.SendEmail' nicht verwendet
[Fehler] mail.pas(74): Undefinierter Bezeichner: 'edit_empfaenger'
[Fehler] mail.pas(74): Nicht genügend wirkliche Parameter
[Fataler Fehler] email.dpr(5): Verwendete Unit 'mail.pas' kann nicht compiliert werden

Hoffe ihr könnt mir weiterhelfen...
Julian

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Di 05.10.04 14:45 
Auf deiner Form heissen die Komponenten immer noch Edit1 und Edit2, vielleicht hast du aus Versehen nur die Caption abgeändert? Kontrolliere noch einmal die Eigenschaft "Name" der Editfelder im Objektinspektor.

Cu,
Udontknow
Juliman Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: Di 05.10.04 14:51 
Jup danke!