{"record":{"id":"a2c8d2edc507bc37","repo":"theonedev/onedev","slug":"unable-to-send-verification-email-as-mail-service","errorCode":null,"errorMessage":"Unable to send verification email as mail service is not configured","messagePattern":"Unable to send verification email as mail service is not configured","errorType":"http","errorClass":"ExplicitException","httpStatus":400,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/rest/resource/EmailAddressResource.java","lineNumber":124,"sourceCode":"\t\t\n\t\temailAddressService.setAsPrimary(emailAddress);\n\n\t\tif (!getAuthUser().equals(owner)) \n\t\t\tauditService.audit(null, \"set email address \\\"\" + emailAddress.getValue() + \"\\\" as primary in account \\\"\" + owner.getName() + \"\\\" via RESTful API\", null, null);\n\t\t\n\t\treturn emailAddressId;\n\t}\n\t\n\t@Api(order=260, description=\"Resend verification email\")\n\t@Path(\"/resend-verification-email\")\n\t@POST\n\tpublic Long resendVerificationEmail(@NotNull Long emailAddressId) {\n\t\tvar emailAddress = emailAddressService.load(emailAddressId);\n\t\tif (!SecurityUtils.isAdministrator() && !emailAddress.getOwner().equals(getAuthUser()))\n\t\t\tthrow new UnauthorizedException();\n\n\t\tif (settingService.getMailConnector() == null)\n\t\t\tthrow new ExplicitException(\"Unable to send verification email as mail service is not configured\");\n\t\tif (emailAddress.isVerified())\n\t\t\tthrow new ExplicitException(\"Unable to send verification email as this email address is already verified\");\n\t\t\n\t\temailAddressService.sendVerificationEmail(emailAddress);\n\t\t\n\t\treturn emailAddressId;\n\t}\n\t\n\t@Api(order=300)\n\t@Path(\"/{emailAddressId}\")\n\t@DELETE\n\tpublic Response deleteEmailAddress(@PathParam(\"emailAddressId\") Long emailAddressId) {\n\t\tvar emailAddress = emailAddressService.load(emailAddressId);\n\t\tif (!SecurityUtils.isAdministrator() && !emailAddress.getOwner().equals(getAuthUser())) \n\t\t\tthrow new UnauthorizedException();\n\t\t\n\t\tif (emailAddress.isPrimary() && emailAddress.getOwner().getPassword() == null) {\n\t\t\tthrow new ExplicitException(\"Cannot delete primary email address of \"","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/rest/resource/EmailAddressResource.java#L106-L142","documentation":"Sending verification email requires a configured mail connector in OneDev's mail settings. If settingService.getMailConnector() returns null, the endpoint throws ExplicitException because there is no mail service through which to send the message.","triggerScenarios":"POST to /resend-verification-email on a server instance where SMTP/mail settings were never configured (fresh install or settings wiped).","commonSituations":"Fresh OneDev installations without SMTP configuration; mail connector removed after an upgrade; dev/test instances without mail setup; Docker deployments without mail settings mounted.","solutions":["Configure the mail connector in Administration > Mail Settings and retry","Verify mail settings survive upgrades/redeploys (persist the config)","Skip verification-email flows in environments without mail configured"],"exampleFix":"// before\nresendVerificationEmail(id); // no mail connector configured\n// after\nconfigureMailConnector(smtpHost, smtpPort, credentials);\nresendVerificationEmail(id);","handlingStrategy":"validation","validationCode":"if (settingService.getMailConnector() == null) throw new IllegalStateException('configure mail settings first');","typeGuard":"boolean mailReady = settingService.getMailConnector() != null;","tryCatchPattern":"try { resendVerificationEmail(id); } catch (ExplicitException e) { /* configure SMTP in admin settings */ }","preventionTips":["Configure mail settings before enabling verification flows","Persist mail config across deployments","Smoke-test mail connectivity after upgrades"],"tags":["rest-api","smtp","configuration","onedev"],"backgroundTag":"missing-required-config","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}