跳至内容
菜单
此问题已终结
1 回复
7378 查看

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

形象
丢弃
最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
5
9月 24
12490
2
10月 24
4256
5
10月 16
8914
1
3月 15
13801
0
12月 24
1564