unit Implementor;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj,
ActiveX, CDO_TLB, SMTPEventSink_TLB, StdVcl;
type
TSMTPOnArrival =
class( TAutoObject, IDisclaimer, ISMTPOnArrival)
protected
procedure OnArrival(
const Msg: IMessage;
var EventStatus: CdoEventStatus);
safecall;
end;
implementation
uses ComServ;
const
ln = #10#13;
TextDisclaimer =
...
HTMLDisclaimer =
...
procedure TSMTPOnArrival.OnArrival(
const Msg: IMessage;
var EventStatus: CdoEventStatus);
safecall;
var
part1, part2:
string;
p: integer;
begin
//Textversion
If Msg.TextBody <> '
'
Then
begin
Msg.TextBody := Msg.TextBody + ln + TextDisclaimer + ln;
end;
//HTML-Version
if Msg.HTMLBody <> '
'
then
begin
p := pos( '
</body>', Msg.HTMLBody);
part1 := Copy( Msg.HTMLBody, 0, p-1);
part2 := Copy( Msg.HTMLBody, p, Length( Msg.HTMLBody));
Msg.HTMLBody := Part1+HTMLDisclaimer+Part2;
end;
//Änderubgen Zurückschreiben
Msg.DataSource.Save;
EventStatus := cdoRunNextSink;
end;
initialization
TAutoObjectFactory.Create(ComServer, TSMTPOnArrival, Class_SMTPOnArrival,
ciMultiInstance, tmApartment);
end.