home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / delphi / TSMTP / SMTP.INT < prev    next >
Encoding:
Text File  |  1996-04-26  |  2.9 KB  |  90 lines

  1. unit Smtp;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, Windows, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, WinSock, ExtCtrls, DsgnIntf, UUCode, MIME, MailBase,
  8.   MailUtil;
  9.  
  10. type
  11.   TStatus = (msIdle,msConnecting,msLogIn,msLogOut,
  12.              msHeaders,msEnvelope,msBody,msAttachment,
  13.              msCancel,msEnCode);
  14.   TEncoding = (etUU,etMIME);
  15.  
  16.   TSMTP = class(TMailBase)
  17.   private
  18.     { Private declarations }
  19.     FFrom : string;
  20.     FRecipient : string;
  21.     FSubject : string;
  22.     FBody : TStrings;
  23.     FCC : TStrings;
  24.     FStatus : TStatus;
  25.     FProgress : Integer;
  26.     FAttachments : TStrings;
  27.     FEncoding : TEncoding;
  28.     FUseDomainAddress : boolean;
  29.     FOnStatusChange : TNotifyEvent;
  30.     FOnProgress : TNotifyEvent;
  31.     procedure SetBody(Value : TStrings);
  32.     procedure SetCC(Value : TStrings);
  33.     procedure SetAttachments(Value : TStrings);
  34.     procedure DoStatusChange(Sender : TObject);
  35.     procedure DoProgress(Sender : TObject);
  36.   protected
  37.     { Protected declarations }
  38.     UULinesList : TList; {List of TStringLists with attachments}
  39.     UniqueID : string;
  40.     Error : boolean;
  41.     Base64 : TBase64;
  42.     QP : TQuotedPrintable;
  43.     UU : TUUCode;
  44.     procedure PrepareUULines;
  45.     procedure PrepareMIMELines;
  46.     procedure SendEnvelope;
  47.     procedure EncodeAttachments;
  48.     procedure CheckForErrors(const s : string);
  49.     procedure RecvData;
  50.     procedure SendBody;
  51.     procedure SendHeaders; virtual;
  52.                 {virtual to allow users to add custom headers}
  53.     procedure SendData(const s : string);
  54.     procedure MIMEProgress(Sender : TObject);
  55.     procedure UUCodeProgress(Sender : TObject);
  56.     procedure ReInit; override;
  57.     function SenderDomain : string;  {11.4}
  58.   public
  59.     { Public declarations }
  60.     constructor Create(AOwner : TComponent); override;
  61.     destructor Destroy; override;
  62.     procedure Open; override;
  63.     procedure LogIn;
  64.     procedure LogOut;
  65.     procedure Send;
  66.     procedure Cancel; override;
  67.     property Status : TStatus read FStatus;
  68.     property Progress : Integer read FProgress;
  69.   published
  70.     { Published declarations }
  71.     property Attachments : TStrings read FAttachments write SetAttachments;
  72.     property From : string read FFrom write FFrom;
  73.     property Recipient : string read FRecipient write FRecipient;
  74.     property CC : TStrings read FCC write SetCC;
  75.     property Subject : string read FSubject write FSubject;
  76.     property Body : TStrings read FBody write SetBody;
  77.     property Encoding : TEncoding read FEncoding write FEncoding default etMIME;
  78.     property UseDomainAddress : boolean read FUseDomainAddress
  79.                  write FUseDomainAddress default true;
  80.     property DefaultPort;
  81.     property OnStatusChange : TNotifyEvent read FOnStatusChange
  82.              write FOnStatusChange;
  83.     property OnProgress : TNotifyEvent read FOnProgress write FOnProgress;
  84.   end;
  85.  
  86. procedure Register;
  87.  
  88. implementation
  89.  
  90.