{"record":{"id":"d683e88f38ecf55b","repo":"passbolt/passbolt_api","slug":"the-data-entered-are-not-correct-emailcontroller","errorCode":null,"errorMessage":"The data entered are not correct","messagePattern":"The data entered are not correct","errorType":"exception","errorClass":"CakeException","httpStatus":500,"severity":"error","filePath":"plugins/PassboltCe/WebInstaller/src/Controller/EmailController.php","lineNumber":125,"sourceCode":"        } else {\n            $this->webInstaller->setSettingsAndSave('email', $data);\n            $this->goToNextStep();\n        }\n    }\n\n    /**\n     * Validate data.\n     *\n     * @param array $data request data\n     * @throws \\Cake\\Core\\Exception\\CakeException The data does not validate\n     * @return void\n     */\n    protected function validateData(array $data)\n    {\n        $form = new EmailConfigurationForm();\n        $this->set('formExecuteResult', $form);\n        if (!$form->execute($data, ['validate' => 'webInstaller'])) {\n            throw new CakeException(__('The data entered are not correct'));\n        }\n    }\n\n    /**\n     * Send test email.\n     *\n     * @param \\Passbolt\\SmtpSettings\\Service\\SmtpSettingsTestEmailService $sendTestEmailService Service injected for unit test purposes\n     * @param array $data request data\n     * @return void\n     */\n    protected function sendTestEmail(SmtpSettingsTestEmailService $sendTestEmailService, array $data)\n    {\n        try {\n            $sendTestEmailService->sendTestEmail($data);\n            $result = ['test_email_status' => true];\n        } catch (Throwable $e) {\n            $result = [\n                'test_email_status' => false,","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/WebInstaller/src/Controller/EmailController.php#L107-L143","documentation":"EmailController::validateData runs EmailConfigurationForm with the 'webInstaller' validation set and throws CakeException 'The data entered are not correct' when execute() returns false. This validates SMTP/email settings posted in the WebInstaller email step before they are applied or used to send a test email.","triggerScenarios":"POSTing the WebInstaller email step with invalid values — missing sender email, malformed email address, empty host, bad port, or unsupported transport — so EmailConfigurationForm::execute($data, ['validate' => 'webInstaller']) fails.","commonSituations":"Typo in SMTP host; sender name/email left blank; non-numeric port; transport name the form does not accept; scripted requests omitting validated fields.","solutions":["Re-render the step and read the per-field errors from formExecuteResult to see which rule failed.","Provide a valid sender email and name, and a syntactically valid SMTP host/port (e.g. host=smtp.example.com, port=587).","Match the transport to your provider (SMTP) and verify credential format (no stray spaces, correct encoding).","Validate the same settings with an external SMTP test (swaks/msmtp) before resubmitting."],"exampleFix":"// before\n{'sender_email': 'admin@', 'host': '', 'port': 'smtp'}\n// after\n{'sender_email': 'admin@example.com', 'sender_name': 'Passbolt', 'host': 'smtp.example.com', 'port': '587'}","handlingStrategy":"validation","validationCode":"const emailRe = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nif (!emailRe.test(emailConfig.sender_email)) throw new Error('invalid sender_email');\nif (!emailConfig.host || !/^[0-9]+$/.test(String(emailConfig.port))) throw new Error('invalid SMTP host/port');","typeGuard":"function isValidEmailConfig(c) {\n  return c && typeof c.host === 'string' && c.host.length > 0 &&\n    /^\\d+$/.test(String(c.port)) &&\n    typeof c.sender_email === 'string' && /@/.test(c.sender_email);\n}","tryCatchPattern":"try {\n  await post('/install/email', emailConfig);\n} catch (e) {\n  if (String(e.message).includes('The data entered are not correct')) {\n    // inspect per-field errors from the re-rendered form and correct them\n  }\n  throw e;\n}","preventionTips":["Always supply a valid sender email and name plus a syntactically correct SMTP host.","Use numeric ports (25, 465, 587, 2525).","Trim whitespace from credentials and hosts.","Mirror the exact field names the installer form expects."],"tags":["webinstaller","form-validation","email","smtp"],"backgroundTag":"invalid-config-value","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}