@ -0,0 +1,50 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Advanced Email Configurator |
|||
=========================== |
|||
* Automatic setup of Outgoing and Incoming Mail Servers. |
|||
|
|||
Installation |
|||
============ |
|||
- www.odoo.com/documentation/17.0/setup/install.html |
|||
- Install our custom addon |
|||
|
|||
License |
|||
------- |
|||
Affero General Public License v3.0 (AGPL v3) |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
* Developer : |
|||
(V17) Ashok P K |
|||
(V18) Anzil K A |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit https://www.cybrosys.com |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import models |
@ -0,0 +1,46 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
{ |
|||
'name': 'Advanced Email Configurator', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Discuss', |
|||
'summary': 'Generate incoming and outgoing mail server.', |
|||
'description': """This module helps to auto-configure the incoming and |
|||
outgoing mail servers directly from the preferences.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['mail'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'data/ir_cron_data.xml', |
|||
'views/provider_server_views.xml', |
|||
'views/res_users_views.xml', |
|||
'views/res_config_settings_views.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!--Scheduled action for fetching mails--> |
|||
<record id="fetch_scheduler_recurring_action" model="ir.cron"> |
|||
<field name="name">Auto Fetch</field> |
|||
<field name="model_id" ref="model_res_users"/> |
|||
<field name="state">code</field> |
|||
<field name="code">model.action_fetch()</field> |
|||
<field name="user_id" ref="base.user_root"/> |
|||
<field name="interval_number">1</field> |
|||
<field name="interval_type">minutes</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,7 @@ |
|||
## Module <email_configurator_advanced> |
|||
|
|||
#### 08.05.2025 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
|
|||
- Initial Commit for Advanced Email Configurator |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import provider_server |
|||
from . import res_config_settings |
|||
from . import res_users |
@ -0,0 +1,92 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class ProviderServer(models.Model): |
|||
"""Class to model provider server in settings->technical""" |
|||
_name = 'provider.server' |
|||
_description = 'Provider Server' |
|||
|
|||
name = fields.Char( |
|||
string='Name', |
|||
help='Enter the provider name.') |
|||
smtp_encryption = fields.Selection( |
|||
selection=[('none', 'None'), |
|||
('starttls', 'TLS (STARTTLS)'), |
|||
('ssl', 'SSL/TLS')], |
|||
string='Connection Encryption', |
|||
required=True, default='none', |
|||
help='Choose the connection encryption scheme') |
|||
smtp_debug = fields.Boolean( |
|||
string='Debugging', |
|||
help="If enabled, the full output of SMTP sessions will " |
|||
"be written to the server log at DEBUG level " |
|||
"(this is very verbose and may include confidential info!)") |
|||
smtp_host = fields.Char( |
|||
string='SMTP Server', |
|||
help="Hostname or IP of SMTP server", |
|||
required=True) |
|||
smtp_port = fields.Integer( |
|||
string='SMTP Port', |
|||
default=25, |
|||
help="SMTP Port. Usually 465 for SSL, and 25 or 587 for other cases.") |
|||
server = fields.Char( |
|||
string='Server Name', |
|||
help="Hostname or IP of the mail server", |
|||
required=True) |
|||
port = fields.Integer(string='Port',help='Specify the port number.') |
|||
server_type = fields.Selection( |
|||
selection=[ |
|||
('imap', 'IMAP Server'), |
|||
('pop', 'POP Server'), |
|||
('local', 'Local Server'), ], |
|||
string='Server Type', |
|||
index=True, required=True, |
|||
default='pop') |
|||
is_ssl = fields.Boolean( |
|||
string='SSL/TLS', |
|||
help="Connections are encrypted with SSL/TLS through a dedicated port " |
|||
"(default: IMAPS=993, POP3S=995)") |
|||
active = fields.Boolean( |
|||
default=True, |
|||
string='Active', |
|||
help='Enable for the model to active state.') |
|||
|
|||
@api.onchange('smtp_encryption') |
|||
def _onchange_smtp_encryption(self): |
|||
"""Function to change the smtp port number of outgoing mail server |
|||
based on encryption.""" |
|||
if self.smtp_encryption == 'ssl': |
|||
self.smtp_port = 465 |
|||
else: |
|||
self.smtp_port = 25 |
|||
|
|||
@api.onchange('server_type', 'is_ssl') |
|||
def _onchange_server_type(self): |
|||
"""Function to change the port number of incoming mail server based |
|||
on server type.""" |
|||
self.port = 0 |
|||
if self.server_type == 'pop': |
|||
self.port = self.is_ssl and 995 or 110 |
|||
elif self.server_type == 'imap': |
|||
self.port = self.is_ssl and 993 or 143 |
@ -0,0 +1,32 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ResConfigSettings(models.TransientModel): |
|||
"""Class to inherit settings and added a new boolean field.""" |
|||
_inherit = 'res.config.settings' |
|||
|
|||
automail_server = fields.Boolean( |
|||
string='Auto Generate Mail Server', |
|||
help='Enable to generate the mail server automatically.', |
|||
config_parameter='email_configurator_advanced.automail_server') |
@ -0,0 +1,119 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import api, fields, models |
|||
from odoo.exceptions import UserError |
|||
|
|||
|
|||
class ProviderServer(models.Model): |
|||
"""Class to inherit users model to add few fields and functions.""" |
|||
_inherit = 'res.users' |
|||
|
|||
pwd = fields.Char( |
|||
string='Password', |
|||
help='Enter the app password of the email.') |
|||
provider = fields.Many2one( |
|||
comodel_name='provider.server', |
|||
string='Provider', |
|||
help='Select a provider from the list.') |
|||
automail = fields.Boolean( |
|||
string='Automail', |
|||
help='Enable if the auto generate mail server in setting is true.', |
|||
compute='_compute_automail', |
|||
default=lambda self: self.env['ir.config_parameter'].sudo().get_param( |
|||
'email_configurator_advanced.automail_server')) |
|||
|
|||
@api.depends('automail') |
|||
def _compute_automail(self): |
|||
"""Function to compute the value based on the field in the setting""" |
|||
if self.env['ir.config_parameter'].sudo().get_param( |
|||
'email_configurator_advanced.automail_server'): |
|||
self.automail = True |
|||
else: |
|||
self.automail = False |
|||
|
|||
def action_confirm(self): |
|||
"""Function to create auto mail server for incoming and outgoing.""" |
|||
if self.provider: |
|||
existing_mail_server = self.env['ir.mail_server'].search([ |
|||
('smtp_user', '=', self.email), |
|||
('name', '=', self.provider.name)], limit=1) |
|||
existing_fetchmail_server = self.env['fetchmail.server'].search([ |
|||
('user', '=', self.email), |
|||
('name', '=', self.provider.name)], limit=1) |
|||
if existing_mail_server: |
|||
existing_mail_server.write({ |
|||
'smtp_encryption': self.provider.smtp_encryption, |
|||
'smtp_debug': self.provider.smtp_debug, |
|||
'smtp_host': self.provider.smtp_host, |
|||
'smtp_port': self.provider.smtp_port, |
|||
'smtp_pass': self.pwd, |
|||
}) |
|||
else: |
|||
self.env['ir.mail_server'].create({ |
|||
'name': self.provider.name, |
|||
'smtp_encryption': self.provider.smtp_encryption, |
|||
'smtp_debug': self.provider.smtp_debug, |
|||
'smtp_host': self.provider.smtp_host, |
|||
'smtp_port': self.provider.smtp_port, |
|||
'smtp_user': self.email, |
|||
'smtp_pass': self.pwd, |
|||
}) |
|||
if existing_fetchmail_server: |
|||
existing_fetchmail_server.write({ |
|||
'server': self.provider.server, |
|||
'port': self.provider.port, |
|||
'server_type': self.provider.server_type, |
|||
'is_ssl': self.provider.is_ssl, |
|||
'password': self.pwd, |
|||
}) |
|||
else: |
|||
self.env['fetchmail.server'].create({ |
|||
'name': self.provider.name, |
|||
'server': self.provider.server, |
|||
'port': self.provider.port, |
|||
'server_type': self.provider.server_type, |
|||
'is_ssl': self.provider.is_ssl, |
|||
'user': self.email, |
|||
'password': self.pwd, |
|||
}) |
|||
existing_mail_server.test_smtp_connection() |
|||
existing_fetchmail_server.button_confirm_login() |
|||
return { |
|||
'type': 'ir.actions.client', |
|||
'tag': 'display_notification', |
|||
'params': { |
|||
'title': 'Connection Successful', |
|||
'type': 'success', |
|||
'message': 'Your connection is successfully established', |
|||
'sticky': False, |
|||
} |
|||
} |
|||
else: |
|||
raise UserError('Select a provider') |
|||
|
|||
def action_fetch(self): |
|||
"""Function for fetching mail on the interval of 1 minute for the |
|||
scheduler action.""" |
|||
existing_fetchmail_server = self.env['fetchmail.server'].search([ |
|||
('user', '=', self.email), |
|||
('name', '=', self.provider.name)], limit=1) |
|||
existing_fetchmail_server.fetch_mail() |
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 967 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 258 KiB |