Skip to content

Configuring SMTP server for no-authentication access#586

Merged
GZTimeWalker merged 2 commits into
workfrom
copilot/allow-smtp-without-credentials
Jul 5, 2026
Merged

Configuring SMTP server for no-authentication access#586
GZTimeWalker merged 2 commits into
workfrom
copilot/allow-smtp-without-credentials

Conversation

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Pull request created by AI Agent

@GZTimeWalker
GZTimeWalker marked this pull request as ready for review July 5, 2026 14:07
Copilot AI review requested due to automatic review settings July 5, 2026 14:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the SMTP mail-sending logic to support SMTP servers that allow sending without SMTP AUTH, by only attempting authentication when both username and password are configured.

Changes:

  • Introduced a _useSmtpAuthentication flag derived from configured username/password.
  • Made both the background sender worker and the SMTP connectivity test skip Authenticate* calls when auth is not configured.

Comment on lines +32 to +40
var hasUserName = !string.IsNullOrWhiteSpace(_options.UserName);
var hasPassword = !string.IsNullOrWhiteSpace(_options.Password);
_useSmtpAuthentication = hasUserName && hasPassword;
_cancellationToken = _cancellationTokenSource.Token;

if (hasUserName != hasPassword)
_logger.SystemLog("SMTP username/password is partially configured. SMTP AUTH will be skipped.",
TaskStatus.Degraded, LogLevel.Warning);

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.35%. Comparing base (7041e21) to head (8c72312).

Files with missing lines Patch % Lines
src/GZCTF/Services/Mail/MailSender.cs 33.33% 5 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             work     #586      +/-   ##
==========================================
- Coverage   59.36%   59.35%   -0.02%     
==========================================
  Files         190      190              
  Lines        9804     9811       +7     
  Branches     1202     1204       +2     
==========================================
+ Hits         5820     5823       +3     
- Misses       3488     3491       +3     
- Partials      496      497       +1     
Files with missing lines Coverage Δ
src/GZCTF/Services/Mail/MailSender.cs 11.51% <33.33%> (+1.38%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GZTimeWalker
GZTimeWalker merged commit 424893c into work Jul 5, 2026
7 of 9 checks passed
@GZTimeWalker
GZTimeWalker deleted the copilot/allow-smtp-without-credentials branch July 5, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants