See also ConfiguringWikiMail.
To enable mail-in:
With Zwiki <= 0.60:
- Install the mailin external method in your wiki folder or root folder. ZMI -> Add external method:
- Id:
mailin
- Title: blank
- Module Name:
ZWiki.mailin
- Function Name:
mailin
- Id:
- Set up an email address that posts incoming messages to the above method via HTTP.
This is the tricky part. You'll normally need sysadmin powers for this, but not always.
With [DarcsRepos|Zwiki-unstable]? >2008/05/10
- Set up an email address that posts incoming messages to SOMEPAGEURL/mailin via HTTP.
It doesn't matter which page you choose; ZWiki or FrontPage are good choices.
Mail server setup examples
Add details of working setups here.
exim
Add this to /etc/aliases (one line, the space after -F is required):
WIKIALIAS: "|/usr/bin/curl -s -F 'msg=<-' http://WIKIURL/mailin"
If the wiki is access-controlled, provide login info with the -u option, or make sure your exim user has a suitable ~/.netrc file and use the -n option. You don't have to use curl of course, it's just the most convenient. Then run newaliases to effect the change.
sendmail
As above except it won't like the <
, so move the curl command into a shell script.
postfix
1) Same config than with exim (only an alias)
2) Or :
main.cf:
transport_maps = hash:/etc/postfix/transport
transport:
wikimh.swishmark.com wikimh:
virtual:
# Wiki Mailin Handlers wiki@domain.com wiki@domain.com@wikimh.domain.com
master.cf:
wikimh unix - n n - - pipe flags= user=nobody argv=/usr/bin/curl -u user:pass -F msg=<- http://localhost:9673/wiki/mailin
qmail
should be easy
a spare procmail-capable mail account
set up procmail rules to do the above
your sole procmail-capable mail account
set up procmail rules to do the above only for messages matching a certain pattern, leaving your ordinary mail untouched
WikiMailNG
a procmail solution, don't know how well it works
Troubleshooting
There are many ways for this not to work. Break it down, bring visibility to each step and rule out variables until you find where it's failing.
- with Zwiki versions 0.32-0.35, be sure to put a bracketed page name in the subject (at or near the beginning) or the mail will be ignored
- make sure curl has sufficient permission to post a comment (and create pages, if you're doing that).
If in doubt get it working with an unprotected wiki first.
To provide authentication, use curl's -u or -n options. The login should have at least
Access contents information
,View
andZwiki: Add comments
permissions. - pretend you are the mailserver - find out what uid it runs as, become that user,
call the curl command exactly as written, pipe in a test message. Eg:
$ cat - | curl -u user:pass -F 'msg=<-' http://your.site/wikifolder/mailin From: me To: wiki Date: now Subject: [TestPage] test test
- check your wiki's recent changes; the message may have gone to an unexpected page
- check your mailbox for bounces; sometimes they get delayed
- watch your EventLog at BLATHER or lower priority while sending mail
- watch your mail server's logs (and/or the postmaster mailbox). Look for delivery activity or errors.
- try the equivalent of "exim -q" or "sendmail -q" to force immediate delivery
- check your mailserver didn't dump the message into a file named "curl -blah http/blah" instead of executing the command
- check the mail-related issues in the issue tracker
- exim may send an error like this to postmaster; if so, add or uncomment the
user = list
line in /etc/exim/exim.conf's system_aliases section. I don't need it here for some reason.:2004-10-21 02:23:01 1CKZ5R-0002jP-00 Neither the system_aliases director nor the address_pipe transport set a uid for local delivery of |/usr/bin/curl -s -F 'msg=<-' http://site/wiki/mailin
Tips
- as of Zwiki 0.36, mail-ins without a bracketed page name in the
subject are delivered to a default page - that whose id is configured
in a
default_mailin_page
string property on the wiki folder, orFrontPage
if it exists, or the first page in the hierarchy. To ignore mail without a page name in the subject, set a blank default_mailin_page. - to allow non-subscribers to mail in, set a
mailin_policy
folder property toopen
- use the mail-in address for your mail-out
mail_replyto
ormail_from
, so replies will go back to the wiki. Instant mailing list. - If you want an industrial-strength mailing list, you can integrate with one; see ZwikiAndMailingLists.
How it works
A special email address is set up that posts incoming messages to an external method called mailin . This does different things depending on how it's called:
If called in the context of a wiki page (http://your.site/wikifolder/SomePage/mailin):
- add a comment to that page.
If called in the context of the wiki folder (http://your.site/wikifolder/mailin), do one of the following:
- if there is no page name in brackets in the subject, choose a default mailin page
- if the named page exists, post the message as a comment on that page
- otherwise, create that page using the message as initial content
- or if the mail alias is of the form
*bugs@...
or '*tracker@...': create a new issue page - or if the mail alias is of the form
spam@...
, add any links in the message body to the banned_links list, if any. See Extensions/mailin.py -> updateSpamBlocks and LinkSpam.
For spam protection, by default mail is accepted only from senders who are subscribed
somewhere in the wiki.
This means sender's exact email address (aside from any real name part) must be subscribed
to at least one page or to the whole wiki; or, a CMF/Plone member who has that email address configured in their CMF/Plone
preferences must be subscribed (NB this last has been disabled for performance reasons).
Where spam is not an issue, eg in an intranet, you can set the mailin_policy
folder property to open
instead.
Postfix Mailin Configuration -- Tue, 14 Dec 2004 12:51:21 -0800 reply
IMAP --Freek Driesenaar, Thu, 03 Feb 2005 02:58:46 -0800 reply
Is there a IMAP based way to configure Mail In? As far as I can see, the provided Mail Server Setup examples are all based on SMTP and I can not (let) change the mail server setup. Thanks in advance.
IMAP --Bob McElrath?, Thu, 03 Feb 2005 11:10:14 -0800 reply
Freek Driesenaar [zwiki-wiki@zwiki.org]? wrote:
Is there a IMAP based way to configure Mail In? As far as I can see, the provided Mail Server Setup examples are all based on SMTP and I can not (let) the mail server setup change. Thanks in advance.
This question is somewhat confused. IMAP is a method of retreiving mail from a single account. It cannot be used to send or accept incoming mail. SMTP is a way to send mail. SMTP is the only way to send mail. An IMAP server cannot be rigged to send mail.
Some mail hosts have a POP-before-send or IMAP-before-send method of authentication, where your mail client has to log in with POP or IMAP before sending mail. But, I assure you, the actual sending and receiving of mail occurs with SMTP. The authentication is just tied together.
IMAP --Freek Driesenaar, Mon, 07 Feb 2005 00:34:06 -0800 reply
Your answer is somewhat confusing - so far I assumed MailIn? to mean getting ZWiki to receive mail
and as far as I understood so far there is more than one way (SMTP) to achieve this. SMTP can be used to receive incoming messages, but only if you can configure your environment to transfer messages (incoming mail) to you. In the environment I work I am not able to do so. I can, however, setup an e-mail account for use by the ZWiki. So, I am not looking for an alternative way to send mail: I am looking for an alternative way to accept incoming mail, preferably by IMAP. Is the question still confused?
IMAP --Bob McElrath?, Mon, 07 Feb 2005 02:00:21 -0800 reply
Freek Driesenaar [zwiki-wiki@zwiki.org]? wrote:
Your answer is somewhat confusing - so far I assumed MailIn? to mean
getting ZWiki to receive mail
and as far as I understood so far
there is more than one way (SMTP) to achieve this. SMTP can be used to
receive incoming messages, but only if you can configure your
environment to transfer messages (incoming mail) to you. In the
environment I work I am not able to do so. I can, however, setup an
e-mail account for use by the ZWiki. So, I am not looking for an
alternative way to send mail: I am looking for an alternative way to
accept incoming mail, preferably by IMAP. Is the question still
confused?
Ah, I understand better now. See Extensions/mailin.py. However you receive mail, you must call mailin with something like:
| curl -n -F 'msg=<-' http://mysite/mywikifolder/mailin
Read the comments at the top of mailin.py for more details.
So, whatever you're using for imap should call mailin (or it could probably be done in a cron job). The instructions on HowToSetUpMailIn are SMTP-specific, unfortunately. If you get this working, please edit HowToSetUpMailIn and describe for us how you did it. ;)
- Just as a guess
- I'd say write a script to use fetchmail to grab all mail, submit with curl as above, and then delete the incoming mail folder. Then run this script with cron every 5 minutes or so.
- This is one disadvantage of this approach
- there will be a delay between sending mail and it appearing on the wiki since imap must poll for new mail. Also I'm guessing you will have to put the mail account password in the script, which sucks.
But, let us know what you come up with... ;)
Unicode errors... --rmaurizzi, Thu, 26 Mar 2009 18:21:47 -0700 reply
If I post a mail with accented characters, I get a:
UnicodeDecodeError?: ascii
codec can't decode byte 0xc3 in position 224: ordinal not in range(128)
The mail IS encoded however. The text of the message from the log is "Ok =C3=88 uno spettacolo pure". Do I have to set a default encoding somewhere? I'm using version 0.60.0 from ubuntu 8.04, on Zope 2.9
Unicode errors... --simon, Fri, 27 Mar 2009 20:32:09 -0700 reply
#1256 (included in 0.60) says this should work.. if the mail has a proper Content-Type header. Check that ?