Browse Source
Merge pull request #292 from Tecnativa/9.0-fix-mail_tracking_mailgun-domain
[FIX] mail_tracking_mailgun: alternative domain
pull/295/head
Pedro M. Baeza
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
14 additions and
5 deletions
-
mail_tracking_mailgun/README.rst
-
mail_tracking_mailgun/__openerp__.py
-
mail_tracking_mailgun/models/mail_tracking_email.py
-
mail_tracking_mailgun/tests/test_mailgun.py
|
|
@ -36,6 +36,8 @@ parameters: |
|
|
|
domain. |
|
|
|
- `mailgun.api_url`: It should be fine as it is, but it could change in the |
|
|
|
future. |
|
|
|
- `mailgun.domain`: In case your sending domain is different from the one |
|
|
|
configured in `mail.catchall.domain`. |
|
|
|
- `mailgun.validation_key`: If you want to be able to check mail address |
|
|
|
validity you must config this parameter with your account Public Validation |
|
|
|
Key. |
|
|
|
|
|
@ -7,7 +7,7 @@ |
|
|
|
{ |
|
|
|
"name": "Mail tracking for Mailgun", |
|
|
|
"summary": "Mail tracking and Mailgun webhooks integration", |
|
|
|
"version": "9.0.1.2.1", |
|
|
|
"version": "9.0.1.3.0", |
|
|
|
"category": "Social Network", |
|
|
|
"website": "https://odoo-community.org/", |
|
|
|
"author": "Tecnativa, " |
|
|
|
|
|
@ -71,7 +71,8 @@ class MailTrackingEmail(models.Model): |
|
|
|
raise ValidationError(_('There is no Mailgun API key!')) |
|
|
|
api_url = icp.get_param( |
|
|
|
'mailgun.api_url', 'https://api.mailgun.net/v3') |
|
|
|
domain = icp.get_param('mail.catchall.domain') |
|
|
|
catchall_domain = icp.get_param('mail.catchall.domain') |
|
|
|
domain = icp.get_param('mailgun.domain', catchall_domain) |
|
|
|
if not domain: |
|
|
|
raise ValidationError(_('A Mailgun domain value is needed!')) |
|
|
|
validation_key = icp.get_param('mailgun.validation_key') |
|
|
|
|
|
@ -102,6 +102,11 @@ class TestMailgun(TransactionCase): |
|
|
|
self.test_event_delivered() |
|
|
|
with self.assertRaises(ValidationError): |
|
|
|
self.env['mail.tracking.email']._mailgun_values() |
|
|
|
# now we set an specific domain for Mailgun: |
|
|
|
# i.e: we configure new EU zone without loosing old domain statistics |
|
|
|
self.env['ir.config_parameter'].set_param( |
|
|
|
'mailgun.domain', 'eu.example.com') |
|
|
|
self.test_event_delivered() |
|
|
|
|
|
|
|
def test_bad_signature(self): |
|
|
|
self.event.update({ |
|
|
@ -159,7 +164,8 @@ class TestMailgun(TransactionCase): |
|
|
|
response = self.env['mail.tracking.email'].event_process( |
|
|
|
None, self.event, self.metadata) |
|
|
|
self.assertEqual('OK', response) |
|
|
|
event = self.event_search('delivered') |
|
|
|
events = self.event_search('delivered') |
|
|
|
for event in events: |
|
|
|
self.assertEqual(event.timestamp, float(self.timestamp)) |
|
|
|
self.assertEqual(event.recipient, self.recipient) |
|
|
|
|
|
|
|