ScriptNukeYahooAds

From 40tude Dialog Wiki

Here is a nice little script Marcus M´┐Żnnig (Thanks Marcus!) made for me to remove the Yahoo sponsor block from incoming e-mails. By modifying the start and end constants you should be able to use it for removing just about any block of text on incoming messages. Paste the text below into the OnBeforeSavingMessage script event. Save, compile, and then run it. Notice how nice your mailing lists look without crappy ads and enjoy!


program OnBeforeSavingMessage;

const yahoo_start=#13#10+'------------------------ Yahoo! Groups Sponsor ---------------------~-->'+#13#10;
const yahoo_end  =#13#10+'---------------------------------------------------------------------~->'+#13#10#13#10;
const maxint=2147483647;

procedure OnBeforeSavingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean);
var i,j:integer;
    s:string;
begin
if isemail=false then exit;
s:=message.text;
i:=pos(yahoo_start,s);
if i>0 then
   begin
   j:=i+pos(yahoo_end,copy(s,i,maxint));
   if j>i then
      begin
      delete(s,i,j-i+length(yahoo_end)+1);
      message.text:=s;
      end;
   end;
end;

begin
end.

Compiled and executed nicely on the closed beta 2.0.7.65, I expect it will compile on ver. 2.0.7.1 as well.


J. Cifer