Skip to content

Commit ae9e26f

Browse files
committed
feat: empty strings can disable SMTP
1 parent 331e9e1 commit ae9e26f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/GZCTF/Services/Mail/MailSender.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public MailSender(
3030
_options = options.Value;
3131
_cancellationToken = _cancellationTokenSource.Token;
3232

33-
if (_options is not { SendMailAddress: not null, Smtp.Host: not null, Smtp.Port: not null })
33+
if (string.IsNullOrWhiteSpace(_options.SendMailAddress) ||
34+
string.IsNullOrWhiteSpace(_options.Smtp?.Host) || _options.Smtp.Port is not null)
3435
return;
3536

3637
_smtpClient = new();

0 commit comments

Comments
 (0)