Email is now Built-in! (#2635)

This commit is contained in:
Joe Milazzo 2024-01-20 11:16:54 -06:00 committed by GitHub
parent 2a539da24c
commit a85644fb6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 5129 additions and 1047 deletions

View file

@ -7,4 +7,5 @@ public class EmailTestResultDto
{
public bool Successful { get; set; }
public string ErrorMessage { get; set; } = default!;
public string EmailAddress { get; set; } = default!;
}

View file

@ -0,0 +1,20 @@
namespace API.DTOs.Settings;
public class SmtpConfigDto
{
public string SenderAddress { get; set; } = string.Empty;
public string SenderDisplayName { get; set; } = string.Empty;
public string UserName { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string Host { get; set; } = string.Empty;
public int Port { get; set; } = 0;
public bool EnableSsl { get; set; } = true;
/// <summary>
/// Limit in bytes for allowing files to be added as attachments. Defaults to 25MB
/// </summary>
public int SizeLimit { get; set; } = 26_214_400;
/// <summary>
/// Should Kavita use config/templates for Email templates or the default ones
/// </summary>
public bool CustomizedTemplates { get; set; } = false;
}

View file

@ -38,11 +38,6 @@ public class ServerSettingDto
/// </summary>
/// <remarks>If null or empty string, will default back to default install setting aka <see cref="DirectoryService.BookmarkDirectory"/></remarks>
public string BookmarksDirectory { get; set; } = default!;
/// <summary>
/// Email service to use for the invite user flow, forgot password, etc.
/// </summary>
/// <remarks>If null or empty string, will default back to default install setting aka <see cref="EmailService.DefaultApiUrl"/></remarks>
public string EmailServiceUrl { get; set; } = default!;
public string InstallVersion { get; set; } = default!;
/// <summary>
/// Represents a unique Id to this Kavita installation. Only used in Stats to identify unique installs.
@ -88,4 +83,20 @@ public class ServerSettingDto
/// How large the cover images should be
/// </summary>
public CoverImageSize CoverImageSize { get; set; }
/// <summary>
/// SMTP Configuration
/// </summary>
public SmtpConfigDto SmtpConfig { get; set; }
/// <summary>
/// Are at least some basics filled in
/// </summary>
/// <returns></returns>
public bool IsEmailSetup()
{
//return false;
return !string.IsNullOrEmpty(SmtpConfig.Host)
&& !string.IsNullOrEmpty(SmtpConfig.UserName)
&& !string.IsNullOrEmpty(HostName);
}
}