Einzelnen Beitrag anzeigen

AndiS75

Registriert seit: 25. Nov 2005
42 Beiträge
 
#15

Re: SQL-Abfrage per EMail verschicken

  Alt 20. Jun 2007, 21:38
Host --> Mein Host und Auth--> atDefault. Nutze Delphi2007. Wenn ich folgen Code als Auth nutze bringt er mir die Fehlermeldung
--> Undefinierter Bezeichner "AuthenticationType"

Delphi-Quellcode:
  case SmtpAuth of
    0: SMTP.AuthenticationType := atNone;
    1: SMTP.AuthenticationType := atLogin; {Simple Login}
  end;
also muss ich folgenden Code verwenden

Delphi-Quellcode:
  case SMTPAuth of
    0 : SMTP.AuthType := atNone;
    1 : SMTP.AuthType := atDefault;
  end;
Hier bringt er mir die Fehlermeldung --> ... ist eine Exeption der Klasse EIdSMTPReplyError mit der Meldung '' aufgetreten. Also
keine Ahnung

Delphi-Quellcode:


procedure TFrmMailMain.AusWertSend(An, Nachricht, vonMail, Betreff, Priority, CT, SMTPServer, SMTPUsername, SMTPPass: String;
                                   SMTPAuth, SMTPPort : integer);
var
  IdMsgSend: TidMessage;
  SMTP: TidSmtp;
  POP: TidPop3;
  i: integer;
begin

  IdMsgSend := TidMessage.Create(nil);
  SMTP := TidSmtp.Create(nil);
  POP := TidPop3.create(nil);
  IdMsgSend.Clear;


  // Plain Text
  with TIdText.Create(IdMsgSend.MessageParts, nil) do
  begin
    ContentType := 'text/plain';
    Body.Text := Nachricht;
  end;

  // HTML Part
  with TIdText.Create(IdMsgSend.MessageParts, nil) do
  begin
    ContentType := 'text/html';
    Body.Text := 'Dateien\MailVorlage.html';
  end;

  with IdMsgSend do
  begin
    ContentType := CT;
    From.Text := vonMail;
    ReplyTo.EMailAddresses := vonMail;
    Subject := Betreff;
    Priority := Priority;
    BccList.EMailAddresses := An;
    ReceiptRecipient.Text := '';
  end;

  IdMsgSend.ContentType := CT;

  case SMTPAuth of
    0 : SMTP.AuthType := atNone;
    1 : SMTP.AuthType := atDefault;
  end;

  {case SmtpAuthType of
    0: SMTP.AuthenticationType := atNone; //Normal
    1: SMTP.AuthenticationType := atLogin; //SMTPAuth
    2: begin //AfterPop
        SMTP.AuthenticationType := atNone;
        POP.Host := POPServer;
        POP.Username := POPUser;
        POP.Password := POPPass;
        POP.Port := POPPort;
        POP.Connect(5);
        POP.Disconnect;
      end;
    3: begin //afterPop+SMTPAuth
        SMTP.AuthenticationType := atLogin;
        POP.Host := POPServer;
        POP.Username := POPUser;
        POP.Password := POPPass;
        POP.Port := POPPort;
        POP.Connect(5);
        POP.Disconnect;
      end;
  end; }


  SMTPUsername := SMTPUsername;
  SMTP.Password := SMTPPass;
  SMTP.Host := SMTPServer;
  SMTP.Port := SMTPPort;

  SMTP.Connect;

  MemoLog.Lines.Add(IntToStr(IdMsgSend.MessageParts.Count));

  try
    SMTP.Send(IdMsgSend);
  finally
    SMTP.Disconnect;
  end;
  IdMsgSend.free;
  SMTP.free;

end;
  Mit Zitat antworten Zitat