Skip to Content
Menu
This question has been flagged
1 Reply
7226 Views

I'm trying to setup the smtp values in the odoo.conf, this values are found in the example config file in https://github.com/odoo/docker/tree/16d5988408434e4678f3bf6318aabad542dec4ee/11.0:

; smtp_password = False
; smtp_port = 25
; smtp_server = localhost
; smtp_ssl = False
; smtp_user = False

However, if I uncomment this lines and change them to a valid smtp server, when I start Odoo and check the config it still has the default values and the emails are not sent. Is there something I'm missing?


Note: I'm setting up multiple instances, I need this config to be injected rather than configured manually in each instance.


Thanks

Avatar
Discard
Best Answer

Theses parameters are used only if no smtp server are found in the database, code extract:

```python

mail_server = self.sudo().search([], order='sequence', limit=1)

if mail_server:

            smtp_server = mail_server.smtp_host

            smtp_user = mail_server.smtp_user

            smtp_password = mail_server.smtp_pass

            smtp_port = mail_server.smtp_port

            smtp_encryption = mail_server.smtp_encryption

            smtp_debug = smtp_debug or mail_server.smtp_debug

else:

            # we were passed an explicit smtp_server or nothing at all

            smtp_server = smtp_server or tools.config.get('smtp_server')

            smtp_port = tools.config.get('smtp_port', 25) if smtp_port is None else smtp_port

            smtp_user = smtp_user or tools.config.get('smtp_user')

            smtp_password = smtp_password or tools.config.get('smtp_password')

            if smtp_encryption is None and tools.config.get('smtp_ssl'):

```

So, in order to use the smtp values in the odoo.conf (or command line) the default mail server must be removed (or archived), then the system will use the provided arguments

Avatar
Discard
Related Posts Replies Views Activity
5
Sep 24
12137
2
Oct 24
4102
5
Oct 16
8753
1
Mar 15
13633
0
Dec 24
1461