Contents
When configured, Moin features two email-based services; sending mail, and receiving mail. Both are explained on this page.
The most common scenario is configuring your wiki to send mail, which is used in the following situations:
Any user can subscribe to changes of wiki pages by either clicking on the envelope icon , or by adding a regex to the "Subscribed wiki pages" field of his user preferences. The system then sends, whenever a page is changed and the author doesn't uncheck the "Send mail notification" checkbox, an email with the author, a link to the page, and the diff of the change. The author does not get notified of his own changes.
To configure mail-sending, the following options need to be configured in your wikiconfig.py file:
Variable name
Default
Description
mail_from
None
From: header used in sent mails, e.g. mail_from = u'Wiki Notifier <noreply@example.com>'. [unicode]
mail_login
"user pwd" if you need to use SMTP AUTH
mail_smarthost
IPv4 address or hostname of an SMTP-enabled server (with optional :port appendix, defaults to 25). Note that email features (notification, mailing of login data) works only if this variable is set.
mail_sendmail
If set to e.g. '/usr/sbin/sendmail -t -i', use this sendmail command to send mail. Default is to send mail by an internal function using SMTP.
In order to enable support for outgoing mails, you must specify the From: address with "mail_from". Furthermore, you must enable a transport, either by SMTP (use "mail_smarthost" to enable it) or by sendmail (use "mail_sendmail" to enable it). If you use "mail_smarthost" and the server requires authentication, then set "mail_login", too.
This value is used for the "From:" and "To:" headers in the emails sent (the "To:" has email address privacy reasons, email is not really sent to this address, but we don't want to disclose any real recipient address). The address is also used as the envelope sender and hence should exist so your wiki's emails are not blocked by spam filtering software.
This is only needed when you use mail_smarthost and a server that requires SMTP AUTH to send mail; in that case, set this to the username and password separated by a space, i.e. "user pwd".
This is the IP or domain name of an FOLDOC:SMTP enabled server. On a Unix host, you can try to use localhost; on a Windows machine this will normally be a machine in your LAN or some host of your ISP.
Moin is able to receive mails. Mainly, you need to know what the e-mail address of the wiki is and send a mail to it. If you supply the target pagename before the wiki address (typing MyWikiPage <wiki@example.com> for example), you will get your mail into the wiki quite easily.
If you want to import mails to your Moin wiki, i.e. allow it to receive and store the mails, you have to setup a few things.
First you have to setup your mail server to pipe every new mail into Moin. The command is moin xmlrpc mailimport. Note that you can use the parameter --config /path/to/dir to supply the path to a directory with a suitable Moin configuration file. Then you have to ensure that there is a file called mailimportconf.py in that directory.
Now you can configure the wiki. There are the following configuration options:
mail_import_wiki_addrs
[]
The e-mail address(es) of the e-mails that should go into the wiki.
mail_import_pagename_envelope
u"%s"
Special use, see below.
mail_import_subpage_template
u"$from-$date-$subject"
This is the template for the pagename generated by the mail import code.
mail_import_pagename_search
['subject', 'to', ]
Where and in which order to search for the target pagename.
mail_import_pagename_regex
r'\[\[([^"]*)\]\]'
secrets or secrets["xmlrpc/ProcessMail"]
""
The secret that matches the one in mailimportconf.py configuration file.
A list of e-mail target addresses of e-mails that should go into the wiki. Moin searches for these addresses to know the target pagename, it should match the address that is known to the mail server. If you use some kind of forwarding mechanism, please put the address(es) your wiki users use to address the wiki first into that list and the address(es) you forward the e-mails to after that.
The default value of this setting is u"%s" and that just means "use the pagename unmodified". You could also configure it to be u"+ %s/" which would add a plus and a blank char in front of what we got and a slash char after what we got from the mail subject or target addr. This is to save your users some typing if you ever want the behaviour triggered by the plus and the slash.
Where (and in what order) to search for the target pagename, default is ['subject', 'to', ] to first look into the subject and then (if we didn't find anything there) to look into the target addresses.
The pattern (regex) we search in the subject line for determining the target pagename, default is r'\[\[([^"]*)\]\]' which simply looks for something like [[TargetPageName]] (same as freelink syntax).
The secret that matches the mailimportconf.py configuration file. The secret is used to let the script authenticate itself at the wiki. The URL consists of the regular wiki URL and ?action=xmlrpc2. It should look like this (there is a sample file shipped in wiki/config):
# This secret has to be known by the wiki server mail_import_secret = u"do_not_choose_a_too_short_secret_or_it_wont_work" # The target URL mail_import_url = u"http://localhost:81/?action=xmlrpc2"
After you have configured the settings explained above, you should be able sending yourself mails. The actual usage is explained below.
To: is (as usual) made of 2 parts, like TEMPLATE <wiki@example.org>. We use the "realname" part to make up the target page name template (can contain special chars, blanks etc.) and the email address part to get it to the right destination. The simplest form of a target page name template is just a pagename like WikiSandBox.
Examples:
Subj: [[TargetPageName]] will work if you put it either at the beginning or the end of the subject. Subject: bla bla bla [[PageName/$date]]
The text of mails with such subject will be added to the pages
TargetPageName or PageName/2006-07-20T14:48:27
The full subject will also be used to build the change comment, prefixed with "Mail: "; variables are not replaced there.
The new page content is made from old page content (if any) plus the content of the email appended at the end. Page content will never get overwritten. Mails that are sent as alternative are shown with their HTML body on the page which is processed by a HTML parser.
If requested by a leading +-sign (e.g. + PageName/), Moin adds a table item to the parent page listing details about the e-mail.
The placeholders $from (containing the name of the sender), $date (the date) and $subject (subject line) are supported.
If the pagename ends with a slash, append the configuration setting email_subpage_template (see above) to the pagename.