function connectionAction() { $smtpModel = new Smtp(); if (isset($_POST['ajax'])) { $_POST['smtp_password'] = str_replace(' ', '+', $_POST['smtp_password']); $smtpModel->fillFromArray($_POST); if ($smtpModel->testConnection()) { Message::echoJsonSuccess(__('smtp_test_connection_ok')); } else { Message::echoJsonError(__('smtp_test_connection_error')); } } }