Autor Beitrag
stigge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Mi 04.04.07 21:38 
Weiß jemand wie ich einer Email einen Anhang hinzufügen kann? Eine normale Email verschicken klappt schon, nur mit Anhang noch nicht.
ausblenden Delphi-Quelltext
1:
2:
3:
var Nachricht: TIdMessage;

TIdAttachment.Create(nachricht.MessageParts, 'D:\next.jpg');

Und die Fehlermeldungen dazu:
[DCC Fehler] Unit1.pas(111): E2034 Zu viele Parameter
[DCC Warnung] Unit1.pas(111): W1020 Instanz von 'TIdAttachment' mit der abstrakten Methode 'TIdAttachment.OpenLoadStream' wird angelegt

Jetzt sollte ich nurnoch wissen was daran falsch ist...
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Mi 04.04.07 22:18 
Schau mal hier. Da gibts ein Tutorial dazu wie man das mit Indy macht.

Edit: Sorry, nimm doch besser das hier: www.delphi-forum.de/...light=anhang%20email

Und btw. gibts eine Suchfunktion... Suche in: Delphi-Forum, Delphi-Library EMAIL ANHANG hätte dir diesen Thread erspart.
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Do 05.04.07 13:17 
user profile iconKarlson hat folgendes geschrieben:
Schau mal hier. Da gibts ein Tutorial dazu wie man das mit Indy macht.

Edit: Sorry, nimm doch besser das hier: www.delphi-forum.de/...light=anhang%20email

Und btw. gibts eine Suchfunktion... Suche in: Delphi-Forum, Delphi-Library EMAIL ANHANG hätte dir diesen Thread erspart.

Ich weiß schon, hab auch schon viele Methoden ausprobiert aber klappt irgendwie nicht...weiß auch nicht warum...er sagt immer, das ich zuviele Parameter angebe... :(
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Do 05.04.07 14:29 
Hiermit klappts auch nicht:
ausblenden Delphi-Quelltext
1:
2:
3:
var Att: TIDAttachment;

Att:=TIDAttachment.Create(nachricht.MessageParts,'C:\k.bmp');

Aber warum nur? Das gibt's doch nicht! Immernoch:
[DCC Fehler] Unit1.pas(114): E2034 Zu viele Parameter
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Fr 06.04.07 11:11 
Ich bin immernoch am Verzweifeln...Hat den niemand Ahnung wie's geht? :(
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Fr 06.04.07 17:09 
*nächstes Schiebeposting*

@mod: Ich hab schon genug Kopien von der Email :wink:
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 06.04.07 17:15 
Gelten für Dich die Forenregeln Nicht ! :!:

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Fr 06.04.07 17:18 
Zitat:

*nächstes Schiebeposting*

@mod: Ich hab schon genug Kopien von der Email


Oh mann, das tut weh :roll:


Warum verwendest du nicht den Code?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
    for i:=0 to lvFiles.Items.Count - 1 do  
    begin  
      Attachment:=lvFiles.Items[i].Caption;  
      TIdAttachment.Create(Msg.MessageParts, Attachment);  
    end;  
    try  
      IdSMTP1.Send(msg);  
    except  
      on E:Sysutils.Exception do  
      begin  
        ShowMessage(e.message);  
      end;  
    end;


(von user profile iconkatjah )
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Fr 06.04.07 17:34 
user profile iconKarlson hat folgendes geschrieben:
Zitat:

*nächstes Schiebeposting*

@mod: Ich hab schon genug Kopien von der Email


Oh mann, das tut weh :roll:


Warum verwendest du nicht den Code?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
    for i:=0 to lvFiles.Items.Count - 1 do  
    begin  
      Attachment:=lvFiles.Items[i].Caption;  
      TIdAttachment.Create(Msg.MessageParts, Attachment); //Zu viele Parameter 
    end;  
    try  
      IdSMTP1.Send(msg);  
    except  
      on E:Sysutils.Exception do  
      begin  
        ShowMessage(e.message);  
      end;  
    end;


(von user profile iconkatjah )

weil er immer und immer wieder sagt, das ich zu viele parameter verwende


user profile iconBlackheart666 hat folgendes geschrieben:
Gelten für Dich die Forenregeln Nicht ! :!:

Ich warte eigentlich auch schon drauf, gekickt zu werden :wink:
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Fr 06.04.07 17:38 
benutzt du das
ausblenden Delphi-Quelltext
1:
Att:=TIDAttachment.Create(nachricht.MessageParts,'C:\k.bmp');					


oder TIdAttachment.Create(Msg.MessageParts, Attachment); ?

Bei ersterem bezöge sich der Fehler nämlich wohl auf die Zuweisung auf Att.

Wenns bei zweiterem nicht klappt, poste mal deine Indy Version.
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Fr 06.04.07 17:43 
Ich verwende:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
var Nachricht: TIdMessage;
    Att: TIDAttachment;

Att := TIDAttachment.Create(nachricht.MessageParts,'C:\k.bmp');

Ich kann Nachricht auch problemlos versenden, halt eben ohne Anhang.
Mit Anhang immer und immer wieder:
Zu viele Parameter
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Fr 06.04.07 17:45 
Dann probiers doch endlich mal mit TIdAttachment.Create(nachricht.MessageParts, FFilename);... :roll:
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Fr 06.04.07 17:48 
user profile iconKarlson hat folgendes geschrieben:
Dann probiers doch endlich mal mit TIdAttachment.Create(nachricht.MessageParts, FFilename);... :roll:

Hab ich schon vor 2 Tagen probiert:
ausblenden Delphi-Quelltext
1:
TIdAttachment.Create(nachricht.MessageParts, 'D:\next.jpg');					

Und die üblichen Fehler:
ausblenden Delphi-Quelltext
1:
2:
[DCC Fehler] Unit1.pas(114): E2034 Zu viele Parameter
[DCC Warnung] Unit1.pas(114): W1020 Instanz von 'TIdAttachment' mit der abstrakten Methode 'TIdAttachment.OpenLoadStream' wird angelegt//Eigentlich ja eher eine Bemerkung
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Fr 06.04.07 17:52 
Hm. Das komische ist das dies ja der übliche Weg zu sein scheint. Hab schon mehrere Beiträge gelesen in denen erwähnt wurde das es so klappt.

Poste mal deine komplette Routine zum versenden.

Und such mal die Deklaration von TIdAttachment auf der F1-Hilfe.

(Habe kein Indy installiert).
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Fr 06.04.07 18:06 
user profile iconKarlson hat folgendes geschrieben:
Hm. Das komische ist das dies ja der übliche Weg zu sein scheint. Hab schon mehrere Beiträge gelesen in denen erwähnt wurde das es so klappt.

Poste mal deine komplette Routine zum versenden.

Und such mal die Deklaration von TIdAttachment auf der F1-Hilfe.

(Habe kein Indy installiert).

Hab gerade noch was interesantes gefunden:
[DCC Fehler] Unit1.pas(117): E2010 Inkompatible Typen: 'TIdMessage' und 'TIdAttachment' :autsch:

Muss man eventuell irgendwas einbinden? (uses-liste)
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Fr 06.04.07 18:10 
Nicht das ich wüsste...

Zitat:

Poste mal deine komplette Routine zum versenden.
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Fr 06.04.07 18:17 
user profile iconKarlson hat folgendes geschrieben:
Nicht das ich wüsste...

Zitat:

Poste mal deine komplette Routine zum versenden.

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:
   Nachricht := TIDMessage.Create(nil);
   SMTP := TidSMTP.create(nil);
   try

      try

         Nachricht.Subject := 'was weiß ich';

         Nachricht.From.Address := adresse;
         Nachricht.Recipients.Add.Address := adresse;
         Nachricht.Sender.Address := adresse;

         Nachricht.Body.Clear;
         Nachricht.Body.Add('irgendein text');
         Nachricht.Body.Add('noch ein text');
         SMTP.Host := hoster;
         SMTP.Port := platz;
         SMTP.Username := namen;
         SMTP.Password := passwort;

         SMTP.Connect;
         SMTP.Send(Nachricht);
         showmessage('Fertig!');
      except
         on E: Exception do
         begin
         showmessage('Fehler!');
         end;
      end;

   finally
SMTP.Disconnect;
smtp.Free;
Nachricht.Free;
end;

Die Email kommt immer an, also daran liegt's nicht.
Ich schicks immer an meinen Account bei web.de
Die Datei, die angehängt werden soll ist übrgens eine Textdatei
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Sa 07.04.07 09:54 
user profile iconstigge hat folgendes geschrieben:
user profile iconBlackheart666 hat folgendes geschrieben:
Gelten für Dich die Forenregeln Nicht ! :!:

Ich warte eigentlich auch schon drauf, gekickt zu werden :wink:

Ich hab das intern mal zur Diskussion gestellt, bis das geklärt ist mach ich hier erstmal dicht. Gut gemeinter Rat: Erstell aufgrund dessen nicht einfach noch ein Topic zu dem Thema.

Gruß,
raziel

_________________
JSXGraph
Dieses Thema ist gesperrt, Du kannst keine Beiträge editieren oder beantworten.

Das Thema wurde von einem Team-Mitglied geschlossen. Wenn du mit der Schließung des Themas nicht einverstanden bist, kontaktiere bitte das Team.