When duplicating a production database into a test (or local) environment, it is crucial to archive mail servers and the cron jobs to avoid their further execution.
update ir_mail_server set active='f';
update fetchmail_server set active='f';
update ir_cron set active='f';
Inbound Mail Servers:
Settings
> Technical
> Email
> Incoming Mail Servers
.Archive
option in Actions
menu.Outbound Mail Servers:
Settings
> Technical
> Email
> Outgoing Mail Servers
.Archive
option in Actions
menu.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: