I am making a php tool to automatically create and correctly encode mailto links.
I have got it working correctly for general text but I need to be able to include code between custom delimiters that will be picked up by an HTML email template creator program.
The programs delimiters are <% %>.
Here is my current code:
$link = "mailto:unsubscribe@example.com?&subject=Unsubscribe&body=Dear <% User.Name %> Please remove me from your mailing list. Ref: <% Customer.Ref %>";
$link = str_replace(" ", "%20", $link);
$link = str_replace(" ", "%0A", $link);
At the moment it will convert the spaces within the delimiters, how can I stop it doing this?