When duplicating a production database into a test environment, it is crucial to archive mail servers. This step is important to prevent the test environment from sending out real emails to actual customers or suppliers but also to fetch the mails from account -this will lead to lost emails in production-, as the test environment might contain live email configurations and data from the production environment. Archiving mail servers ensures that the testing process does not interfere with real operations or cause confusion among stakeholders.
Inbound Mail Servers:
Settings
> Technical
> Email
> Incoming Mail Servers
.Active
checkbox to disable the mail server.Outbound Mail Servers:
Settings
> Technical
> Email
> Outgoing Mail Servers
.Active
checkbox.For a more automated approach, especially useful when dealing with multiple mail servers, you can use the Odoo Terminal extension. This method is efficient for quickly disabling all mail servers.
Terminal Command:
$search_outbound = $(search -m ir.mail_server);
repeat -t $search_outbound['length'] -c "write -m ir.mail_server -i $search_outbound[$repeat_index]['id'] -v {active: false}";
$search_inbound = $(search -m fetchmail.server);
repeat -t $search_inbound['length'] -c "write -m fetchmail.server -i $search_inbound[$repeat_index]['id'] -v {active: false}"
To execute: