See also ConfiguringWikiMail.

To enable mail-in:

With Zwiki <= 0.60:

  1. 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
  2. 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

  1. 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.

Tips

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):

If called in the context of the wiki folder (http://your.site/wikifolder/mailin), do one of the following:

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.


comments:

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 ?