Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.

To create a new cookbook entry, fill in or remove the sections below.

looks like this doesn't work yet in PmWiki 2
19 November 2004


This lets people contact you without the pain of giving away your email address to spam-bots. It allows you to place a small web form on a wiki page that sends email to a fixed email address.


Use Attach:mailform.php.txt and include it to your config.php. It adds the markup-command mailform:xxx. xxx is a name that you can associate with an email-address in your config.php

Example for config.php

$MailFormDefaultSender = '';

This will give you the markup mailform:nils which will create a mailform that sends mails to If the sender leaves the sender address-field emtpy, the mail will be sent from

Required variables

The sender from which the mail is sent if the 'Your address' field in the form was left empty.
An array containing the relation of names and email-addresses (e.g. $MailFormAddresses['nils'] = '' will let you use mailform:nils in a WikiPage to send a mail to '')

Optional: Assign values to any of these variables to customize the look of the form.

The message displayed after sending the mail (default: "Message has been sent successfully!")
The message displayed after failing to send. (default: "Message could not be sent!")
The message displayed on an error. At the moment this means that the receiver-address is empty. (default: "An error occurred")
Contains replacements for the string contained in $MailFormFmt. Each xxx in $MailFormFmt will be substituted by $MailFormString['xxx'] in the standard $MailFormFmt, the variables Your Address, Subject, Message, Send are in use. ackString is automatically replaced by the appropriate message from $MailFormMsg.
A string that is prepended to the mail text. (default: "")
A string that is appended to the mail text. (default: "\n-------------------------------------------\n"."This message was sent by the PmWiki MailForm at "."$ScriptUrl")
The HTML code of the template. I don't write it down here. Use the source, Luke. If you change it, don't forget the hidden fields and the variables $ackString and $1.


  • Append senders IP Address into the mail

Add the following line to config.php


."This message was sent by the PmWiki MailForm at "
.$ScriptUrl." from the IP-Address "

See Also


29.2.2004First version
29.2.2004A few bug fixes
29.2.2004Changed $MailFormTemplate to $MailFormFmt,
 Added some i18n support with the $MailFormString[] array
1.3.2004Bugfix: Insertion of target name in form was missing
 Use local variable for formatting to enable multiple forms per page (not tested)
16.5.2004Changed regex to mailform:(\w+) in order to allow mailform:nils%comment% to be processed correctly as mailform:nils

Comments & Bugs

I don't like the template for the form yet. It uses tables and no CSS. If anyone feels like redoing it, feel free.

I've adjusted it to use definition lists and made it 508/WCAG compliant. I use it on [(approve links) edit diff]. --[(approve links) edit diff]

Very nifty! A breeze to install and works like a charm. Thanks! Oneida



GPL pmwiki-2.3.34 -- Last modified by {{simon}}

from IP: ip should be disabled by default for security reasons