//(C)Marcus Mönnig & Ingo Pflanz
program OnBeforeSendingMessage;
function OnBeforeSendingMessage(var Message: TStringlist; Servername:
string; IsEmail: boolean):boolean;
var i,j:integer;
s:string;
originalemail:string;
newemaillocal:string;
newemaildomain:string;
emailuser:string;
expiredate:string;
lastdayofmonth:string;
begin
result:=true;
if isemail then exit;
//replace invalid with userpart of email ('user' in us...@arcor.de)
emailuser:='kilowatt_radio';
originalemail:=emailuser+'@spam.de';
newemaillocal:=emailuser+'@';
newemaildomain:='myway.com-Remove';
case formatdatetime('mm',now) of
// '01', '03', '05', '07', '08', '10', '12': lastdayofmonth:='31';
'01' : lastdayofmonth:='31';
'03' : lastdayofmonth:='31';
'05' : lastdayofmonth:='31';
'07' : lastdayofmonth:='31';
'08' : lastdayofmonth:='31';
'10' : lastdayofmonth:='31';
'12' : lastdayofmonth:='31';
'02' : begin
if isleapyear(CurrentYear) then
lastdayofmonth:='29'
else
lastdayofmonth:='28';
end
else
lastdayofmonth:='30'
end;
expiredate:=formatdatetime('hhyyyyMMmmss',now)+lastdayofmonth;
for i:=0 to Message.count-1 do
begin
s:=message.strings[i];
if s='' then break; //only scan through headers
j:=pos(originalemail,s);
if j>0 then
begin
delete(s,j,length(originalemail));
insert(newemaillocal+newemaildomain+expiredate,s,j);
message.strings[i]:=s;
end;
end;
end;
begin
end.
--
Best Regards, Keith
http://kilowatt-radio.org NW Oregon Radio Page