diff --git a/mailgun/README.rst b/mailgun/README.rst deleted file mode 100644 index f87a734..0000000 --- a/mailgun/README.rst +++ /dev/null @@ -1,35 +0,0 @@ -.. image:: https://itpp.dev/images/infinity-readme.png - :alt: Tested and maintained by IT Projects Labs - :target: https://itpp.dev - -========= - Mailgun -========= - -With this module you can receive incoming messages from mailgun. -There is no IMAP or POP3 servers on mailgun that is to be used with odoo. -That is why we need this module. It fetches messages from mailgun using their API -and stores them in odoo. - -TODO -==== - -* If emails are sent when odoo is stopped then Mailgun will retry (other than for delivery notification) during 8 hours at the following intervals before stop trying: 10 minutes, 10 minutes, 15 minutes, 30 minutes, 1 hour, 2 hour and 4 hours. This could be fixed by fetching undelivered messages after odoo starts. - -Questions? -========== - -To get an assistance on this module contact us by email :arrow_right: help@itpp.dev - -Contributors -============ -* Ildar Nasyrov -* Ivan Yelizariev - -Further information -=================== - -Odoo Apps Store: https://apps.odoo.com/apps/modules/9.0/mailgun/ - - -Tested on `Odoo 9.0 `_ diff --git a/mailgun/__init__.py b/mailgun/__init__.py deleted file mode 100644 index 9e5827f..0000000 --- a/mailgun/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# -*- coding: utf-8 -*- -from . import controllers -from . import models diff --git a/mailgun/__manifest__.py b/mailgun/__manifest__.py deleted file mode 100644 index 52cb528..0000000 --- a/mailgun/__manifest__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -{ - "name": "Mailgun", - "author": "IT-Projects LLC, Ildar Nasyrov", - "license": "Other OSI approved licence", # MIT - "support": "apps@itpp.dev", - "website": "https://twitter.com/nasyrov_ildar", - "category": "Discuss", - "version": "10.0.1.1.0", - "depends": ["mail"], - "data": ["data/cron.xml"], -} diff --git a/mailgun/controllers/__init__.py b/mailgun/controllers/__init__.py deleted file mode 100644 index 757b12a..0000000 --- a/mailgun/controllers/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# -*- coding: utf-8 -*- -from . import main diff --git a/mailgun/controllers/main.py b/mailgun/controllers/main.py deleted file mode 100644 index d020815..0000000 --- a/mailgun/controllers/main.py +++ /dev/null @@ -1,17 +0,0 @@ -# -*- coding: utf-8 -*- -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" diff --git a/mailgun/data/cron.xml b/mailgun/data/cron.xml deleted file mode 100644 index 38b5cd4..0000000 --- a/mailgun/data/cron.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Mailgun - domain verification - 10 - minutes - 288 - True - ir.config_parameter - mailgun_verify - - - diff --git a/mailgun/doc/changelog.rst b/mailgun/doc/changelog.rst deleted file mode 100644 index c422520..0000000 --- a/mailgun/doc/changelog.rst +++ /dev/null @@ -1,13 +0,0 @@ -Updates -======= - -`1.1.0` -------- - -- ADD: automatic domain verification - -------- -`1.0.0` -------- - -- Init version diff --git a/mailgun/doc/index.rst b/mailgun/doc/index.rst deleted file mode 100644 index f86acfb..0000000 --- a/mailgun/doc/index.rst +++ /dev/null @@ -1,53 +0,0 @@ -========= - Mailgun -========= - -Usage -===== - -* register or log in http://mailgun.com -* On https://mailgun.com/app/domains click on you domain, e.g. sandbox123...mailgun.org domain. Here you can see all information needed to configure odoo outgoing mail feature - - * if you in sandbox domain, add Authorized Recepient - * Copy API Key value into odoo - - * Open menu ``Settings / Parameters / System Parameters`` - * Create new parameter - - * key: ``mailgun.apikey`` - * Value: API Key from mailgun (``key-...``) - * click Save - - * Copy smtp credentials into odoo - - * open ``Settings / Technical / Email / Outgoing Mail Servers`` - - * delete localhost - * create new server - - * Description: ``mailgun`` - * SMTP Server: ``smtp.mailgun.org`` - * Connection Security: ``SSL/TLS`` - * Username: e.g. ``postmaster@sandbox123....mailgun.org`` - * Password: ``...`` (copy ``Default Password`` from mailgun) - - * From odoo menu ``Settings / General Settings`` edit Alias Domain - - * Put your mailgun domain here. E.g. sandbox123...mailgun.org - * Click 'Apply' button - -* From https://mailgun.com/cp/routes create new route - - * Priority: ``0`` - * Filter expression: ``catch_all()`` - * Actions: ``store(notify="http:///mailgun/notify")`` - -* Set admin's email alias. Open menu ``Settings / Users / Users`` - - * choose your user and click ``[Edit]`` - * On Preference tab put alias into Messaging Alias field and click ``[Save]``. E.g. ``admin@sandbox...mailgun.org`` - -* Via your favorite mail client (e.g. gmail.com) send email to ``admin@sandox...mailgun.org`` -* Open ``Discuss`` in odoo -* See your message there -* Reply to the message and check it in your mail client (e.g. gmail.com) diff --git a/mailgun/i18n/es.po b/mailgun/i18n/es.po deleted file mode 100644 index 5d1c7a9..0000000 --- a/mailgun/i18n/es.po +++ /dev/null @@ -1,30 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * mailgun -# -# Translators: -# Randall Castro , 2018 -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-12-19 16:49+0000\n" -"PO-Revision-Date: 2017-12-19 16:49+0000\n" -"Last-Translator: Randall Castro , 2018\n" -"Language-Team: Spanish (https://www.transifex.com/it-projects-llc/" -"teams/76080/es/)\n" -"Language: es\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. module: mailgun -#: model:ir.model,name:mailgun.model_mail_thread -msgid "Email Thread" -msgstr "Hilo de correo electrónico" - -#. module: mailgun -#: model:ir.model,name:mailgun.model_ir_config_parameter -msgid "ir.config_parameter" -msgstr "ir.config_parameter" diff --git a/mailgun/i18n/mailgun.pot b/mailgun/i18n/mailgun.pot deleted file mode 100644 index e79cda9..0000000 --- a/mailgun/i18n/mailgun.pot +++ /dev/null @@ -1,25 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * mailgun -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" -"Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: mailgun -#: model:ir.model,name:mailgun.model_mail_thread -msgid "Email Thread" -msgstr "" - -#. module: mailgun -#: model:ir.model,name:mailgun.model_ir_config_parameter -msgid "ir.config_parameter" -msgstr "" - diff --git a/mailgun/models.py b/mailgun/models.py deleted file mode 100644 index 7b3430c..0000000 --- a/mailgun/models.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- -import logging - -import requests -from openerp import api, models - -try: - import simplejson as json -except ImportError: - import json - -_logger = logging.getLogger(__name__) - - -class MailThread(models.AbstractModel): - _inherit = "mail.thread" - - @api.model - def mailgun_fetch_message(self, message_url): - api_key = self.env["ir.config_parameter"].sudo().get_param("mailgun.apikey") - res = requests.get( - message_url, - headers={"Accept": "message/rfc2822"}, - auth=("api", api_key), - verify=False, - ) - self.message_process(False, res.json().get("body-mime")) - - -class IrConfigParameter(models.Model): - _inherit = ["ir.config_parameter"] - - @api.model - def mailgun_verify(self): - verified = self.get_param("mailgun.verified") - if verified: - return - api_key = self.get_param("mailgun.apikey") - mail_domain = self.get_param("mail.catchall.domain") - if api_key and mail_domain: - url = "https://api.mailgun.net/v3/domains/%s/verify" % mail_domain - res = requests.put(url, auth=("api", api_key)) - if ( - res.status_code == 200 - and json.loads(res.text)["domain"]["state"] == "active" - ): - self.set_param("mailgun.verified", "1")