Hi,
In the editor I add a hyperlink (unsubscribe link) using following code:
Code
vAntwoordadres := 'email@mydomain.com'; wpEmailEditor.Changing; wpEmailEditor.BeginUpdate; wpEmailEditor.UndoBufferSaveTo(wpEmailEditor.ActivePar, wpuReplaceParTotal); par := wpEmailEditor.ActiveText.AppendNewPar(); wpEmailEditor.UndoBufferSaveTo(Par, wpuReplaceParTotal); startobj := par.AppendNewObject(wpobjHyperlink,true,false); par.Append('Unsubscribe by clicking here'); endobj := par.AppendNewObject(wpobjHyperlink,true,true);hyperlink endobj.SetTag(startobj.NewTag); startobj.Source := 'mailto:' + vAntwoordadres + '?Subject=UNSUBSCRIBE';
To check if this unsubscribe-link is present in the editor I use following code:
Code
function UnsubscribeLinkAvailable(Editor : TWPRichText) : Boolean;var i : Integer; aList : TWPTextObjList ;begin Result := False; aList := TWPTextObjList.Create; Editor.TextObjectsGetList(aList, wpobjHyperlink, false); for i := 0 to aList.Count-1 do begin if Pos(UpperCase('?Subject=UNSUBSCRIBE'), UpperCase(aList.Items[i].Source)) > 0 then Result := True; end; aList.Free;end;
Now I need to update the vAntwoordadres (=Emailaddress) in the mailto: by code. Is there a way to accomplish this?