[IMP] Improve code to prevent failure of test case from addons.mail.tests.test_mail_features