{ This include is a little a-la-templates hack here are all the "default" type defines which you need to redefine yourself after including this file. You only redefine those which are used ofcourse }{$ifndef __front_type__} {$ERROR Undefined type for quasi-template!}{$endif}const MAX_FRONT_ITEMS = 10;type TLFront = class // it's a queue ladies and gents protected FEmptyItem: __front_type__; FItems: array[0..MAX_FRONT_ITEMS-1] of __front_type__; FTop, FBottom: Integer; FCount: Integer; function GetEmpty: Boolean; public constructor Create(const DefaultItem: __front_type__); function First: __front_type__; function Remove: __front_type__; function Insert(const Value: __front_type__): Boolean; procedure Clear; property Count: Integer read FCount; property Empty: Boolean read GetEmpty; end;
if smtpQuery.RecordCount > 0 Then Begin smtpName := smtpQuery.FieldByName('smtp_auth_name').AsString = 'Yes'; smtpPass := smtpQuery.FieldByName('smtp_pass').AsString = 'Yes'; smtpHost := smtpQuery.FieldByName('server').AsString = 'Yes'; smtpTo := smtpQuery.FieldByName('email').AsString = 'Yes'; smtpFrom := 'alerts@helpdex.net'; smtpSubject := ''Test Message'; SMTP := TLSMTPClient.Create(Self); if smtpQuery.FieldByName('smtp_auth').AsInteger > 0 then Begin if SMTP.HasFeature('AUTH LOGIN') then // use login if possible SMTP.AuthLogin(smtpName, smtpPass) else if SMTP.HasFeature('AUTH PLAIN') then // fall back to plain if possible SMTP.AuthPlain(smtpName, smtpPass); end; smtpQuery.Close; message := 'A test Message'; if (not SMTP.Connected) then begin SMTP.Connect(smtpHost, 25); end; try SMTP.SendMail(smtpFrom, smtpTo, smtpSubject, message); except end; end;
type __front_type__ = TMySpeciallyDefinedTypeForThisPrettyQueue;