[pmwiki-users] Question about mailto links with extras

Petko Yotov 5ko at 5ko.fr
Mon Dec 13 11:44:03 CST 2010


On Monday 13 December 2010 13:08:33 Ben Pitzer wrote:
> to be ignoring the pipe before the link text, and treating that as part of
> the email body, while showing the link on the page as the entire contents
> of the mailto link, instead of just the desired link text. 

> [[mailto:user at domain.com?subject=Handover Template&body=Line1: %0ALine2:
> %0ALine3 [some text]: %0A | Handover Template]]

Hello. There is a conflict with the link brackets, parentheses and possibly 
other characters that need to be encoded to appear in links. If you can't 
change these characters, I could only suggest to use a custom markup to url-
encode the full body content - you'll need a wiki admin to enable it, but it 
will make your life much easier.

If you add to config.php the following line :

  Markup('{{{}}}', '>{$var}', '/\\{\\{\\{(.*?)\\}\\}\\}/es',
    'rawurlencode(PSS("$1"))');

then, in your wiki page, you can add {{{any text between tripple braces}}} 
even newlines instead of %0A:

  [[mailto:user at domain.com?subject={{{Handover Template}}}&body={{{
Line1 :
Line2 :
Line3 (some text) : 
Line4 [test] :
}}} | Handover Template]]

The text between the tripple braces will be correctly encoded. Again, there is 
no garantee that the link will work in all browsers and in all e-mail clients.

(There is a MarkupExprPlus 'urlencode' recipe in the Cookbook, but it cannot 
handle multiple lines.)

Petko

> > Hello. The link should really be on one line. If you want to insert
> > newline
> > characters in the future e-mail, use the combination "%0A", like this:
> >  [[ mailto:test at example.net?body=Line1:%0ALine2:%0ALine3: | e-mail me ]]
> > 
> > This way of defining a message body is probably not supported by all
> > browsers
> > and e-mail clients. It may be more convenient to use a Form-to-mail
> > function:
> > you create a form in your wiki website, visitors fill it and you receive
> > the
> > results in your e-mail. There is a PmForm module which is able to do
> > this, see
> > 
> >  http://www.pmwiki.org/wiki/Cookbook/PmForm     and
> >  http://www.pmwiki.org/pmform/PmForm/MailForm   for the form-to-mail
> > 
> > function
> > 
> > PmForm works well, but you need an administrator to install it.
> > 
> > Petko



More information about the pmwiki-users mailing list