Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
7292 Zobrazení

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!

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
říj 22
1809
1
srp 20
3833
2
kvě 24
2234
2
pro 23
14634
0
říj 23
33