home *** CD-ROM | disk | FTP | other *** search
- unit Smtp;
-
- interface
-
- uses
- SysUtils, Windows, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, WinSock, ExtCtrls, DsgnIntf, UUCode, MIME, MailBase,
- MailUtil;
-
- type
- TStatus = (msIdle,msConnecting,msLogIn,msLogOut,
- msHeaders,msEnvelope,msBody,msAttachment,
- msCancel,msEnCode);
- TEncoding = (etUU,etMIME);
-
- TSMTP = class(TMailBase)
- private
- { Private declarations }
- FFrom : string;
- FRecipient : string;
- FSubject : string;
- FBody : TStrings;
- FCC : TStrings;
- FStatus : TStatus;
- FProgress : Integer;
- FAttachments : TStrings;
- FEncoding : TEncoding;
- FUseDomainAddress : boolean;
- FOnStatusChange : TNotifyEvent;
- FOnProgress : TNotifyEvent;
- procedure SetBody(Value : TStrings);
- procedure SetCC(Value : TStrings);
- procedure SetAttachments(Value : TStrings);
- procedure DoStatusChange(Sender : TObject);
- procedure DoProgress(Sender : TObject);
- protected
- { Protected declarations }
- UULinesList : TList; {List of TStringLists with attachments}
- UniqueID : string;
- Error : boolean;
- Base64 : TBase64;
- QP : TQuotedPrintable;
- UU : TUUCode;
- procedure PrepareUULines;
- procedure PrepareMIMELines;
- procedure SendEnvelope;
- procedure EncodeAttachments;
- procedure CheckForErrors(const s : string);
- procedure RecvData;
- procedure SendBody;
- procedure SendHeaders; virtual;
- {virtual to allow users to add custom headers}
- procedure SendData(const s : string);
- procedure MIMEProgress(Sender : TObject);
- procedure UUCodeProgress(Sender : TObject);
- procedure ReInit; override;
- function SenderDomain : string; {11.4}
- public
- { Public declarations }
- constructor Create(AOwner : TComponent); override;
- destructor Destroy; override;
- procedure Open; override;
- procedure LogIn;
- procedure LogOut;
- procedure Send;
- procedure Cancel; override;
- property Status : TStatus read FStatus;
- property Progress : Integer read FProgress;
- published
- { Published declarations }
- property Attachments : TStrings read FAttachments write SetAttachments;
- property From : string read FFrom write FFrom;
- property Recipient : string read FRecipient write FRecipient;
- property CC : TStrings read FCC write SetCC;
- property Subject : string read FSubject write FSubject;
- property Body : TStrings read FBody write SetBody;
- property Encoding : TEncoding read FEncoding write FEncoding default etMIME;
- property UseDomainAddress : boolean read FUseDomainAddress
- write FUseDomainAddress default true;
- property DefaultPort;
- property OnStatusChange : TNotifyEvent read FOnStatusChange
- write FOnStatusChange;
- property OnProgress : TNotifyEvent read FOnProgress write FOnProgress;
- end;
-
- procedure Register;
-
- implementation
-
-