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.
16 lines
563 B
16 lines
563 B
import re
|
|
|
|
from odoo import http
|
|
from odoo.http import request
|
|
|
|
|
|
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 re.match("^https://[^/]*api.mailgun.net/", message_url):
|
|
# simple security check failed
|
|
raise Exception("wrong message-url")
|
|
request.env["mail.thread"].sudo().mailgun_fetch_message(message_url)
|
|
return "ok"
|