Back to index

moin  1.9.0~rc2
ProcessMail.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - This plugin is used for multi-tier mail processing
00004 
00005     @copyright: 2006 MoinMoin:AlexanderSchremmer
00006     @license: GNU GPL, see COPYING for details.
00007 """
00008 
00009 from MoinMoin import log
00010 logging = log.getLogger(__name__)
00011 
00012 from MoinMoin.mail import mailimport
00013 
00014 def execute(xmlrpcobj, secret, mail):
00015     request = xmlrpcobj.request
00016     secret = xmlrpcobj._instr(secret)
00017     mail = str(mail)
00018 
00019     if request.cfg.secrets['xmlrpc/ProcessMail'] != secret:
00020         return u"Invalid password"
00021 
00022     try:
00023         mailimport.import_mail_from_string(request, mail)
00024     except mailimport.ProcessingError, e:
00025         err = u"An error occured while processing the message: " + str(e.args)
00026         logging.error(err)
00027         return xmlrpcobj._outstr(err)
00028     return xmlrpcobj._outstr(u"OK")