AppendWikiPage

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


appendWikiPage is a bash script that will take an email message (or any other file piped into it), and create a PmWiki page. In combination with procmail, it will allow you to setup a special email address to which you can send information that you'd like to have included in your PmWiki, without having to create the page manually.

Download the script here.

Setup

  • Copy the downloaded file, appendWikiPage, somewhere convenient. I keep mine in my ~/bin directory.
  • Copy the program pmwe from the pmwiki/scripts directory, to a location in your $PATH. Verify that pmwe works by running it and editing a wiki page. Typing "pmwe", from the command line, should allow you to edit the Main.WikiSandbox page located at http://www.pmichaud.com/wiki/Main/WikiSandbox.
  • Verify that the following programs are available on your system, somewhere in your $PATH:
      echo, grep, & sed
  • Edit the following variable in appendWikiPage:
WikiDir: the path to a temporary directory on your local system (i.e. /var/tmp)
  • Add the following receipe to your .procmailrc:
      
      # send 'wiki' files to wiki
      :0                                 
      * ^TOappendWikiPage@mydomain.com
      | /home/tom/bin/appendWikiPage 
Be sure to edit the "TO" line to reflect the desired email address, and the last line to the location where you saved appendWikiPage in step #1.
  • You'll need to setup the proper alias in your MTA to forward any mail that is sent to appendWikiPage@mydomain.com (for example) to your regular email address (so that the procmail receipe will be executed). Alternately, setup a new user named appendWikipage and put the procmail recipe there.
  • Setup is complete.

Usage:

A WikiPage will be created from any mail sent to appendWikiPage@mydomain.com. The title of Group.Page will be determined by the following markup, containing within the email message itself:

append:Groupname.PageName: beginning of selection
append:: end of selection
  • If the WikiPage already exists, the selected text is appended to the end of the existing page.

Example markup

append:Main.LinuxTipsTricks
This paragraph will be appended to the page Main.LinuxTipsTricks. If the page doesn't yet exist, it will be created.
append:

append:Dogs.ColliesAreFun
This is another paragraph in the same email message, regarding a different subject. It will be saved to the page Dogs.ColliesAreFun.
append:

Questions/suggestions

  • Feel free to send email to tom@hisword.net.

pmwiki-2.5.9 -- Last modified by {{Michael Geddes}}

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

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_REFERER] => http://www.pmwiki.org/wiki/Cookbook-V1/AppendWikiPage
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=Cookbook%2dV1%2fAppendWikiPage
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=Cookbook%2dV1%2fAppendWikiPage
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook-V1/AppendWikiPage
            [REDIRECT_SCRIPT_URL] => /wiki/Cookbook-V1/AppendWikiPage
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afIXL0obx6fCuNpQH8-WLgAAAMA
            [REDIRECT_URL] => /wiki/Cookbook-V1/AppendWikiPage
            [REMOTE_ADDR] => 216.73.216.31
            [REMOTE_PORT] => 48513
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/Cookbook-V1/AppendWikiPage
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook-V1/AppendWikiPage
            [SCRIPT_URL] => /wiki/Cookbook-V1/AppendWikiPage
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afIXL0obx6fCuNpQH8-WLgAAAMA
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777473327.9625
            [REQUEST_TIME] => 1777473327
            [argv] => Array
                (
                    [0] => n=Cookbook%2dV1%2fAppendWikiPage
                )

            [argc] => 1
        )

)