Difference between revisions of "Talk:EmailToWiki.pl"

From Organic Design wiki
(Event driven installation: command_user)
m (Event driven installation: wrong conditional syntax)
Line 38: Line 38:
 
command = /var/www/extensions/EmailToWiki/EmailToWiki.pl /var/www/EmailToWiki.conf
 
command = /var/www/extensions/EmailToWiki/EmailToWiki.pl /var/www/EmailToWiki.conf
 
command_user = Debian-exim
 
command_user = Debian-exim
condition = "${if {!def:h_X-Spam-Flag:}}"
+
condition = "${if !def:h_X-Spam-Flag: {1}{0}}"
 
</pre>}}
 
</pre>}}
  

Revision as of 01:52, 6 January 2009

EmailToWiki.pl is called from crontab and has one parameter specifying the name of a configuration file which should reside in the same directory as the script. The config file is eval'd and should set the following variables:

{{{1}}}

Event driven installation

The biggest problem with this extension is the inefficient polling of the POP box which makes it unresponsive and consumes unnecessary resources on a regular basis.

This could be configured in a more event-driven way by integrating with the exim4 router configuration. Specifically the queryprogram router would be used. The program should return REDIRECT :blackhole: if the message matches any of its rules and is destined for the wiki, or PASS if not so it can be processed by the next router instead.

This would allow the mails to be checked as they come in and if destined for a wiki would be routed there straight away instead of going to the usual mail directory for storage.

The router should be placed after the spam router so that we can place a condition in it to only match non-spams which will greatly cut down on the processing.

The router section to add after the spam_check router in /var/www/exim4/exim4.conf.template is as follows:

# 860: EmailToWiki router
email_to_wiki:
	driver = queryprogram
	command = /var/www/extensions/EmailToWiki/EmailToWiki.pl /var/www/EmailToWiki.conf
	command_user = Debian-exim
	condition = "${if !def:h_X-Spam-Flag: {1}{0}}"

See also