Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
7298 Widoki

Hi,

I need to configure incoming and outgoing email server. generally we create it through technical--->outgoing email server. through this way every time when we create a fresh database we need to setup it again and again. 

So is their any way to setup it through code. 

Thanks in Advance!

Awatar
Odrzuć
Najlepsza odpowiedź

Hello Pallavi,

Incoming Mail Servers and Outgoing Mail Servers are two models.

All you have to do is to create records in those models.

Check this example of Creating an Outgoing Mail Server from XML Data.

Eg:


<record id="ir_mail_server_localhost0" model="ir.mail_server" forcecreate="0">
<field name="name">localhost</field>
<field name="smtp_host">localhost</field>
<field eval="25" name="smtp_port"/>
<field eval="10" name="sequence"/>
</record>


It is simply a data creation. Like all models.


Thanks & Regards

Avinash NK

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

Create a data record in xml. But it will be better to exclude user id and password from it.

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- For Outgoing Mail server-->
<record id="out_going_mailserver_data" model="ir.mail_server">
<field name="name">Description</field>
<field name="sequence">Priority</field>
<field name="smtp_host">SMTP Server</field>
<field name="smtp_port">SMTP Port</field>
<field name="smtp_encryption">Connection Security</field>
<field name="smtp_user">Username</field>
<field name="smtp_debug">Debugging</field>
<field name="smtp_pass">Password</field>
</record>
<!-- For Incoming mail server-->
<record id="in_coming_mailserver_data" model="ir.mail_server">
<field name="name">Name</field>
<field name="type">Type</field>
<field name="server">Server Name</field>
<field name="port">Port</field>
<field name="is_ssl">SSL/TLS</field>
<field name="user">Username</field>
<field name="password">Password</field>
<field name="object_id">Create a New Record</field>
<field name="priority">Server Priority</field>
<field name="attach">Keep Attachments</field>
<field name="original">Keep Original</field>
<field name="active">Active</field>
</record>
</data>
</odoo>

Regards

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
paź 22
1809
1
sie 20
3840
2
maj 24
2239
2
gru 23
14641
0
paź 23
33