You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
662 B
19 lines
662 B
# -*- coding: utf-8 -*-
|
|
from openerp.addons.web import http
|
|
from openerp.addons.web.http import request
|
|
import werkzeug
|
|
import email
|
|
import requests
|
|
import simplejson
|
|
|
|
class MailMailgun(http.Controller):
|
|
|
|
@http.route('/mailgun/notify', auth='public', type='http', csrf=False)
|
|
def mailgun_notify(self, **kw):
|
|
# mailgun notification in json format
|
|
message_url = kw.get('message-url')
|
|
if not message_url.startswith('https://api.mailgun.net/'):
|
|
# simple security check failed
|
|
raise Exception('wrong message-url')
|
|
request.env['mail.thread'].sudo().mailgun_fetch_message(message_url)
|
|
return 'ok'
|