diff --git a/ApiDto/Requests/Configuration/EmailRequest.cs b/ApiDto/Requests/Configuration/EmailRequest.cs
new file mode 100644
index 0000000..7770c6e
--- /dev/null
+++ b/ApiDto/Requests/Configuration/EmailRequest.cs
@@ -0,0 +1,45 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Mirea.Api.Dto.Requests.Configuration;
+
+///
+/// Represents a request to configure email settings.
+///
+public class EmailRequest
+{
+ ///
+ /// Gets or sets the server address.
+ ///
+ [Required]
+ public required string Server { get; set; }
+
+ ///
+ /// Gets or sets the email address from which emails will be sent.
+ ///
+ [Required]
+ public required string From { get; set; }
+
+ ///
+ /// Gets or sets the password for the email account.
+ ///
+ [Required]
+ public required string Password { get; set; }
+
+ ///
+ /// Gets or sets the port number.
+ ///
+ [Required]
+ public int Port { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether SSL is enabled.
+ ///
+ [Required]
+ public bool Ssl { get; set; }
+
+ ///
+ /// Gets or sets the username.
+ ///
+ [Required]
+ public required string User { get; set; }
+}
\ No newline at end of file
diff --git a/Endpoint/Controllers/Configuration/SetupController.cs b/Endpoint/Controllers/Configuration/SetupController.cs
index ccc51be..d5eb17e 100644
--- a/Endpoint/Controllers/Configuration/SetupController.cs
+++ b/Endpoint/Controllers/Configuration/SetupController.cs
@@ -214,6 +214,32 @@ public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigur
return true;
}
+
+ [HttpPost("SetEmail")]
+ [TokenAuthentication]
+ [BadRequestResponse]
+ public ActionResult SetEmail([FromBody] EmailRequest? request)
+ {
+ var settings = (request == null) switch
+ {
+ true => new EmailSettings(),
+ false => new EmailSettings
+ {
+ Server = request.Server,
+ From = request.From,
+ Password = request.Password,
+ Port = request.Port,
+ Ssl = request.Ssl,
+ User = request.User
+ }
+ };
+
+ var general = GeneralConfig;
+ general.EmailSettings = settings;
+ GeneralConfig = general;
+
+ return true;
+ }
}