Encoding a sendto message

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
Posts: 1
Joined: Sun Nov 22, 2009 3:03 am

Encoding a sendto message

Post by David-en8 »

I'm trying to take some text and us it to generate a URL that will generate an e-mail.

The format for the URL is:
<a href="mailto:YourName@YourSite.com? cc=someone@YourSite.com&bcc=someoneElse@YourSite.com &subject=Shipping%20Information%20Request&body=Please%20tell%20me%20if%20my%20order%20has%20shipped!">Shipping Request</a>

As you can see the spaces need converting to %20 and if I want new lines in the body I have to replace the CRLF to %0D%0A

I can use the map filter to convert the spaces and line ends but how to I ensure that the filter only get applied to part of the original text?

The text below is generated by a mail merge and can be changed if required.

The original text is:
Name:First Last
Subject:The subject of the e-mail
Body:The body with a new line
and one more
and another with an e-mail address david@abc.com
Link:Click here to send

What I need output is:

Code: Select all

<a href="mailto:First.Last@YourSite.com? subject=The%20subject%20of%20the%20e-mail&body=The%20body%20with%20a%20new%20line%0D%0Aand%20one%20more%0D%0Aand%20onother%20with%20an%20e-mail%20address%20david@abc.com">Click here to send</a><p>
Any help would be appreciated, David
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia

Re: Encoding a sendto message

Post by DataMystic Support »

Just use a perl search/replace pattern to create a restriction -


Code: Select all

Replace with

Code: Select all

and add your map filter as a subfilter.
Post Reply