very basic example:
modify the demo you have to:
(set ReceiveMode = rmRaw)
unit Main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
IdBaseComponent, IdComponent, IdTCPServer, IdSMTPServer, StdCtrls,
IdMessage,IdEMailAddress;
type
TForm1 = class(TForm)
IdSMTPServer1: TIdSMTPServer;
procedure IdSMTPServer1CommandAUTH(ASender: TIdCommand);
procedure IdSMTPServer1CheckUser(ASender: TIdCommand;
var Accept: Boolean; Username, Password: String);
procedure IdSMTPServer1CommandRCPT(const ASender: TIdCommand;
var Accept, ToForward: Boolean; EMailAddress: String;
var CustomError: String);
procedure IdSMTPServer1CommandMAIL(const ASender: TIdCommand;
var Accept: Boolean; EMailAddress: String);
procedure IdSMTPServer1ReceiveRaw(ASender: TIdCommand;
var VStream: TMemoryStream; RCPT: TIdEMailAddressList);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.IdSMTPServer1CommandAUTH(ASender: TIdCommand);
begin
// This is where you would process the AUTH command - for now, we send a
error
// AThread.Connection.Writeln();
ASender.Response.Text:= IdSMTPServer1.Messages.ErrorReply
end;
procedure TForm1.IdSMTPServer1CheckUser(ASender: TIdCommand;
var Accept: Boolean; Username, Password: String);
begin
// This event allows you to 'login' a user - this is used internall in the
// IdSMTPServer to validate users connecting using the AUTH.
Accept := true;
end;
procedure TForm1.IdSMTPServer1CommandRCPT(const ASender: TIdCommand;
var Accept, ToForward: Boolean; EMailAddress: String;
var CustomError: String);
begin
// This is required!
// You check the EMAILADDRESS here to see if it is to be accepted /
processed.
// Set Accepted := True if its allowed
// Set ToForward := True if its needing to be forwarded.
Accept := True;
end;
procedure TForm1.IdSMTPServer1CommandMAIL(const ASender: TIdCommand;
var Accept: Boolean; EMailAddress: String);
begin
// This is required!
// You check the EMAILADDRESS here to see if it is to be accepted /
processed.
// Set Accepted := True if its allowed
Accept := True;
end;
procedure TForm1.IdSMTPServer1ReceiveRaw(ASender: TIdCommand;
var VStream: TMemoryStream; RCPT: TIdEMailAddressList);
begin
VStream.savetofile('c:\1.txt') ;
end;
end.
Bas Gooijen
Quote
"?ner Gltekin" <ogulte...@intersol.com.tr> wrote in message
news:3c0d0990_1@dnews...
Quote
> Does anyone have a example with Indy SMTPServer v.9.0.
> (example with 8.1 doesn't work with 9.0 and I can not find version 8.1)
> Thanks.
> Oner.