theonedev/onedev · error · ExplicitException

Unable to send verification email as mail service is not con

Error message

Unable to send verification email as mail service is not configured

What it means

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.

Source

Thrown at server-core/src/main/java/io/onedev/server/rest/resource/EmailAddressResource.java:124

		
		emailAddressService.setAsPrimary(emailAddress);

		if (!getAuthUser().equals(owner)) 
			auditService.audit(null, "set email address \"" + emailAddress.getValue() + "\" as primary in account \"" + owner.getName() + "\" via RESTful API", null, null);
		
		return emailAddressId;
	}
	
	@Api(order=260, description="Resend verification email")
	@Path("/resend-verification-email")
	@POST
	public Long resendVerificationEmail(@NotNull Long emailAddressId) {
		var emailAddress = emailAddressService.load(emailAddressId);
		if (!SecurityUtils.isAdministrator() && !emailAddress.getOwner().equals(getAuthUser()))
			throw new UnauthorizedException();

		if (settingService.getMailConnector() == null)
			throw new ExplicitException("Unable to send verification email as mail service is not configured");
		if (emailAddress.isVerified())
			throw new ExplicitException("Unable to send verification email as this email address is already verified");
		
		emailAddressService.sendVerificationEmail(emailAddress);
		
		return emailAddressId;
	}
	
	@Api(order=300)
	@Path("/{emailAddressId}")
	@DELETE
	public Response deleteEmailAddress(@PathParam("emailAddressId") Long emailAddressId) {
		var emailAddress = emailAddressService.load(emailAddressId);
		if (!SecurityUtils.isAdministrator() && !emailAddress.getOwner().equals(getAuthUser())) 
			throw new UnauthorizedException();
		
		if (emailAddress.isPrimary() && emailAddress.getOwner().getPassword() == null) {
			throw new ExplicitException("Cannot delete primary email address of "

View on GitHub (pinned to d44925c47c)

Solutions

  1. Configure the mail connector in Administration > Mail Settings and retry
  2. Verify mail settings survive upgrades/redeploys (persist the config)
  3. Skip verification-email flows in environments without mail configured

Example fix

// before
resendVerificationEmail(id); // no mail connector configured
// after
configureMailConnector(smtpHost, smtpPort, credentials);
resendVerificationEmail(id);
Defensive patterns

Strategy: validation

Validate before calling

if (settingService.getMailConnector() == null) throw new IllegalStateException('configure mail settings first');

Type guard

boolean mailReady = settingService.getMailConnector() != null;

Try / catch

try { resendVerificationEmail(id); } catch (ExplicitException e) { /* configure SMTP in admin settings */ }

Prevention

When it happens

Trigger: POST to /resend-verification-email on a server instance where SMTP/mail settings were never configured (fresh install or settings wiped).

Common situations: Fresh OneDev installations without SMTP configuration; mail connector removed after an upgrade; dev/test instances without mail setup; Docker deployments without mail settings mounted.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/a2c8d2edc507bc37. Report an issue: GitHub.