-
31mailgun/README.rst
-
48mailgun/__manifest__.py
-
14mailgun/__openerp__.py
-
14mailgun/data/cron.xml
-
15mailgun/data/ir_cron_data.xml
-
3mailgun/doc/changelog.rst
-
111mailgun/doc/index.rst
-
BINmailgun/images/mailgun_main.png
-
35mailgun/models.py
-
4mailgun/models/__init__.py
-
25mailgun/models/ir_config_parameter.py
-
18mailgun/models/mail_thread.py
-
BINmailgun/static/description/icon.png
-
332mailgun/static/description/index.html
-
BINmailgun/static/description/mailgun_add_domain.png
-
BINmailgun/static/description/mailgun_auth_recipients.png
-
BINmailgun/static/description/mailgun_auth_recipients_form.png
-
BINmailgun/static/description/mailgun_domain_details.png
-
BINmailgun/static/description/mailgun_odoo_general.png
-
BINmailgun/static/description/mailgun_odoo_mail_alias.png
-
BINmailgun/static/description/mailgun_odoo_outgoing.png
-
BINmailgun/static/description/mailgun_odoo_partner_email.png
-
BINmailgun/static/description/mailgun_odoo_sys_param.png
-
BINmailgun/static/description/mailgun_route.png
-
BINmailgun/static/description/mailgun_route_form.png
@ -0,0 +1,48 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2018 Ildar Nasyrov <https://it-projects.info/team/iledarn> |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
|||
{ |
|||
"name": """Mailgun""", |
|||
"summary": """Setup the outgoing and incoming mail flow easily by using Mailgun""", |
|||
"category": "Discuss", |
|||
"live_test_url": "http://apps.it-projects.info/shop/product/mailgun?version=11.0", |
|||
"images": ["images/mailgun_main.png"], |
|||
"version": "11.0.1.1.0", |
|||
"application": False, |
|||
|
|||
"author": "IT-Projects LLC, Ildar Nasyrov", |
|||
"support": "apps@it-projects.info", |
|||
"website": "https://it-projects.info/team/iledarn", |
|||
"license": "LGPL-3", |
|||
"price": 389.00, |
|||
"currency": "EUR", |
|||
|
|||
"depends": [ |
|||
"mail", |
|||
], |
|||
"external_dependencies": {"python": [], "bin": []}, |
|||
"data": [ |
|||
'data/ir_cron_data.xml', |
|||
], |
|||
"demo": [ |
|||
], |
|||
"qweb": [ |
|||
], |
|||
|
|||
"post_load": None, |
|||
"pre_init_hook": None, |
|||
"post_init_hook": None, |
|||
"uninstall_hook": None, |
|||
|
|||
"auto_install": False, |
|||
"installable": True, |
|||
|
|||
"demo_title": "Mailgun", |
|||
"demo_addons": [], |
|||
"demo_addons_hidden": [], |
|||
"demo_url": "mailgun", |
|||
"demo_summary": "Easy to send outgoing and fetch incoming messages by using Mailgun", |
|||
"demo_images": [ |
|||
"images/mailgun_main.png", |
|||
] |
|||
} |
@ -1,14 +0,0 @@ |
|||
{ |
|||
'name': "Mailgun", |
|||
'author': "IT-Projects LLC, Ildar Nasyrov", |
|||
'license': 'LGPL-3', |
|||
"support": "apps@it-projects.info", |
|||
'website': "https://twitter.com/nasyrov_ildar", |
|||
'category': 'Discuss', |
|||
'version': '1.1.0', |
|||
'depends': ['mail'], |
|||
'data': [ |
|||
'data/cron.xml', |
|||
], |
|||
'installable': False |
|||
} |
@ -1,14 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data noupdate="1"> |
|||
<record id="mailgun_domain_verification" model="ir.cron"> |
|||
<field name="name">Mailgun - domain verification</field> |
|||
<field name='interval_number'>10</field> |
|||
<field name='interval_type'>minutes</field> |
|||
<field name="numbercall">288</field> |
|||
<field name="active">True</field> |
|||
<field name="model">ir.config_parameter</field> |
|||
<field name="function">mailgun_verify</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data noupdate="1"> |
|||
<record id="mailgun_domain_verification" model="ir.cron"> |
|||
<field name="name">Mailgun - domain verification request</field> |
|||
<field name="model_id" ref="model_ir_config_parameter"/> |
|||
<field name="interval_number">10</field> |
|||
<field name="interval_type">minutes</field> |
|||
<field name="numbercall">10</field> |
|||
<field name="state">code</field> |
|||
<field name="code">model.mailgun_verify()</field> |
|||
<field name="doall" eval="True"/> |
|||
</record> |
|||
</data> |
|||
</openerp> |
After Width: 750 | Height: 371 | Size: 384 KiB |
@ -1,35 +0,0 @@ |
|||
import requests |
|||
import simplejson |
|||
|
|||
from openerp import models, api |
|||
|
|||
|
|||
import logging |
|||
_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 simplejson.loads(res.text)["domain"]["state"] == "active": |
|||
self.set_param('mailgun.verified', '1') |
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import mail_thread |
|||
from . import ir_config_parameter |
@ -0,0 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
import requests |
|||
import simplejson |
|||
|
|||
from openerp import models, api |
|||
|
|||
import logging |
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class IrConfigParameter(models.Model): |
|||
_inherit = ['ir.config_parameter'] |
|||
|
|||
@api.model |
|||
def mailgun_verify(self): |
|||
verified = self.sudo().get_param('mailgun.verified') |
|||
if verified: |
|||
return |
|||
api_key = self.sudo().get_param('mailgun.apikey') |
|||
mail_domain = self.sudo().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 simplejson.loads(res.text)["domain"]["state"] == "active": |
|||
self.sudo().set_param('mailgun.verified', '1') |
@ -0,0 +1,18 @@ |
|||
# -*- coding: utf-8 -*- |
|||
import requests |
|||
|
|||
from odoo import models, api |
|||
|
|||
|
|||
import logging |
|||
_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')) |
After Width: 100 | Height: 100 | Size: 2.1 KiB |
@ -0,0 +1,332 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<h2 class="oe_slogan" style="color:#875A7B;">Mailgun</h2> |
|||
<h3 class="oe_slogan">Easy to setup the outgoing and incoming mail flow</h3> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
<div class="alert alert-success" style="padding:0.3em 0.6em; font-size: 150%;"> |
|||
The module provides Odoo and Mailgun integration to be able to easily configure <em>Outgoing</em> and <em>Incoming</em> mail flow. |
|||
<div style="margin-top:2%;"> |
|||
From Mailgun side you get: |
|||
<ul style="padding-left: 1.6em;"> |
|||
<li style="margin-top: 0.3em;"> |
|||
Powerful Sending Infrastructure |
|||
</li> |
|||
<li> |
|||
Intelligent Inbound Routing & Storage |
|||
</li> |
|||
<li> |
|||
Tracking and Analytics |
|||
</li> |
|||
<li> |
|||
Email Validation |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h3 class="oe_slogan">Mailgun Configuration</h3> |
|||
<h4 class="oe_slogan"><b>Manage Domains</b></h4> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
<ul style="padding-left: 1.4em;"> |
|||
<li> |
|||
Create account on <a href="https://mailgun.com" target="_blank">Mailgun</a> service |
|||
</li> |
|||
<li> |
|||
Add domain in <b>Domains</b> menu |
|||
</li> |
|||
</ul> |
|||
Note that the state of your domain should be <b>Active</b> to be able to use it from Odoo side. To verify it follow the instruction <a href="https://help.mailgun.com/hc/en-us/articles/202052074-How-do-I-verify-my-domain-" target="_blank">How do I verify my domain</a> |
|||
</font> |
|||
</p> |
|||
</div> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_add_domain.png"/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12 text-center"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
Click on added domain name and see all the information needed to configure your <em>Incoming</em> and <em>Outgoing</em> mail feature. |
|||
</font> |
|||
</p> |
|||
</div> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_domain_details.png"/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12 text-center"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
If you use sandbox domain, add <b>Authorized Recipient</b> first (sandbox domains are restricted to <a href="https://help.mailgun.com/hc/en-us/articles/217531258" target="_blank">authorized recipients</a>) |
|||
</font> |
|||
</p> |
|||
</div> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_auth_recipients.png"/> |
|||
</div> |
|||
<br/> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_auth_recipients_form.png"/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced" style="margin-top: 5em;"> |
|||
<h4 class="oe_slogan"><b>Routes</b></h4> |
|||
<div class="oe_span12 text-center"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
Navigate to <b>Routes</b> menu and create a new route |
|||
</font> |
|||
</p> |
|||
</div> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_route.png"/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
Set the following fields and values: |
|||
<ul> |
|||
<li> |
|||
<b>Expression Type</b>: Custom |
|||
</li> |
|||
<li> |
|||
<b>Raw Expression</b>: match_recipient('.*@your_mail_domain') |
|||
</li> |
|||
<li> |
|||
<b>Actions</b>: |
|||
<ul> |
|||
<li> |
|||
Check the box <em>Store and notify</em> |
|||
</li> |
|||
<li> |
|||
Put there http://your_odoo_domain/mailgun/notify |
|||
</li> |
|||
</li> |
|||
</ul> |
|||
</font> |
|||
</p> |
|||
</div> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_route_form.png"/> |
|||
</div> |
|||
<div class="oe_span12 text-center"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
<b>Now everything is ready to move to Odoo configuration.</b> |
|||
</font> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced" style="margin-top: 6em;"> |
|||
<h3 class="oe_slogan">Odoo Configuration</h3> |
|||
<h4 class="oe_slogan"><b>Outgoing Mail Feature</b></h4> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
At first, activate <a href="https://odoo-development.readthedocs.io/en/latest/odoo/usage/debug-mode.html" target="_blank">the developer mode</a>. Then go to <em>Settings → Technical → Email → Outgoing Mail Servers</em> menu and populate the following fields: |
|||
<ul> |
|||
<li> |
|||
<b>Description</b> - e.g. Mailgun |
|||
</li> |
|||
<li> |
|||
<b>SMTP Server</b> - smtp.mailgun.org |
|||
</li> |
|||
<li> |
|||
<b>Connection Security</b> - SSL/TLS |
|||
</li> |
|||
<li> |
|||
<b>Username</b> - use <em>Default SMTP Login</em> from mailgun |
|||
</li> |
|||
<li> |
|||
<b>Password</b> - use <em>Default Password</em> from mailgun |
|||
</li> |
|||
</ul> |
|||
Once the fields are populated, click <b>Test Connection</b> button to check the connection to smtp server. If everything is ok, you can see popup message <em>Connection Test Succeeded! Everything seems properly set up!</em> and you are able to send messages now. |
|||
</font> |
|||
</p> |
|||
</div> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_odoo_outgoing.png"/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h4 class="oe_slogan"><b>Incoming Mail Feature</b></h4> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
Note that to setup incoming mailing, it is not required to setup <em>Incoming Mail Server</em>. |
|||
<br/> |
|||
Open <em>Settings → General Settings</em> menu: |
|||
<ul> |
|||
<li> |
|||
Check the box <b>External Email Servers</b> |
|||
</li> |
|||
<li> |
|||
Set as <b>Alias Domain</b> the domain name from Mailgun |
|||
</li> |
|||
</ul> |
|||
Save the changes. |
|||
</font> |
|||
</p> |
|||
</div> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_odoo_general.png"/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
Setup mailgun API credentials in <em>Settings → Parameters → System Parameters</em> menu. Create new parameter: |
|||
<ul> |
|||
<li> |
|||
<b>Key</b> - mailgun.apikey |
|||
</li> |
|||
<li> |
|||
<b>Value</b> - key-12345... |
|||
</li> |
|||
</ul> |
|||
</font> |
|||
</p> |
|||
</div> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_odoo_sys_param.png"/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12 text-center"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
Now you can configure mail aliases for users. Go to <em>Settings → Users</em> menu and open user form (e.g. for Administrator). Then switch to <em>Preferences</em> tab and select an existing alias or create new one in the <b>Alias</b> field. |
|||
</font> |
|||
</p> |
|||
</div> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_odoo_mail_alias.png"/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12 text-center"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
Open the user's related partner and set <b>Email</b> - the email is used for replying on user messages |
|||
</font> |
|||
</p> |
|||
</div> |
|||
<div class="oe_screenshot" align="center"> |
|||
<img style="max-width: 80%" src="mailgun_odoo_partner_email.png"/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12 text-center"> |
|||
<p class="oe_mt32"> |
|||
<font style="font-size: 120%;"> |
|||
<b> |
|||
Everything is done! It's time to send/receive email messages now! |
|||
</b> |
|||
</font> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span8"> |
|||
<h2>Need our service?</h2> |
|||
<p class="oe_mt32">Contact us by <a href="mailto:apps@it-projects.info">email</a> or fill out <a href="https://www.it-projects.info/page/website.contactus " target="_blank">request form</a></p> |
|||
<ul> |
|||
<li><a href="mailto:apps@it-projects.info">apps@it-projects.info <i class="fa fa-envelope-o"></i></a></li> |
|||
<li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li> |
|||
</ul> |
|||
</div> |
|||
<div class="oe_span4"> |
|||
<div class="stamp" style="width:200px;"> |
|||
<div style="margin-top: 15px; |
|||
position: relative; |
|||
font-family:'Vollkorn', serif; |
|||
font-size: 16px; |
|||
line-height: 25px; |
|||
text-transform: uppercase; |
|||
font-weight: bold; |
|||
color: #75526b; |
|||
border: 3px dashed #75526b; |
|||
float: left; |
|||
padding: 4px 12px; |
|||
-webkit-transform: rotate(6deg); |
|||
-o-transform: rotate(6deg); |
|||
-moz-transform: rotate(6deg); |
|||
-ms-transform: rotate(6deg);"> |
|||
Tested on Odoo<br/>11.0 community |
|||
</div> |
|||
<div style="margin-top: 15px; |
|||
position: relative; |
|||
font-family:'Vollkorn', serif; |
|||
font-size: 16px; |
|||
line-height: 25px; |
|||
text-transform: uppercase; |
|||
font-weight: bold; |
|||
color: #75526b; |
|||
border: 3px dashed #75526b; |
|||
float: left; |
|||
padding: 4px 12px; |
|||
-webkit-transform: rotate(-7deg); |
|||
-o-transform: rotate(-7deg); |
|||
-moz-transform: rotate(-7deg); |
|||
-ms-transform: rotate(-7deg);"> |
|||
Tested on Odoo<br/>11.0 enterprise |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
After Width: 1196 | Height: 509 | Size: 133 KiB |
After Width: 1135 | Height: 916 | Size: 150 KiB |
After Width: 1079 | Height: 443 | Size: 68 KiB |
After Width: 1209 | Height: 916 | Size: 135 KiB |
After Width: 1257 | Height: 681 | Size: 112 KiB |
After Width: 1192 | Height: 647 | Size: 113 KiB |
After Width: 1186 | Height: 671 | Size: 114 KiB |
After Width: 969 | Height: 653 | Size: 83 KiB |
After Width: 1192 | Height: 647 | Size: 108 KiB |
After Width: 1179 | Height: 921 | Size: 287 KiB |
After Width: 1179 | Height: 921 | Size: 201 KiB |