Table of Content
HAL Forum
procedure InsertStringBeforeStringInAttachment (
record Attach2Vc Attachment,string AddStr,string SearchStr)
Description:
Inserts a string before a string based search target in an attachment record.
Parameters:
Attachment Attachment record that will be modified by this procedure
AddStr Add this tring
SearchStr Before the position of this search target
updating procedure AddSignature(var record EMailQueVc EMailQuep)
begin
  record ConfSignVc csp;
  record Attach2Vc Attach2r;
  record MailVc Mailr;
  row EMailQueVc emarw;
  string 255 tstr;
  Integer i,rwcnt,cscnt;
  LongInt l;
  Integer line;

  rwcnt = MatRowCnt(EMailQuep);
  for (i=0;i<rwcnt;i=i+1) begin
    MatRowGet(EMailQuep,i,emarw);
    if (emarw.RowTyp==1) then begin
      if (FindUserInMailbox(emarw.AddrCode,tstr,l)) then begin
        csp.SerNr = l;
        if (ReadFirstMain(csp,1,true)) then begin
// trying something new....
          cscnt = SizeTextCnt(csp);
          while (i<cscnt) begin
            tstr = StringFromText(csp,i,255);
            i = i + len(tstr);
            if (len(tstr)==0) then begin
              i = i + 1;
            end;
            if (IsHtmlMail(EMailQuep,Attach2r)) then begin
              CopySignatureFilesToEMailQuer(csp,EMailQuep);
              InsertStringBeforeStringInAttachment(Attach2r,tstr,"</body>");
              goto LAddSignature;
            end else begin
              AddToText(tstr,EMailQuep);
            end;
          end;
        end;
        goto LAddSignature;
      end;          
    end;
  end;
LAddSignature:;
  return;
end;

Related topics:
««