Skip to content

Bug: SMTP configuration in appsettings.console.json is not being read #337

@EMarshallCode

Description

@EMarshallCode

Version:
PingCastle 3.5.0.44

Environment:

  • OS: Windows
  • .NET Runtime: 8.0.23
  • Previous working version: 3.4.1.38

Description
After upgrading from 3.4.1.38 to 3.5.0.44, SMTP email delivery no longer works. PingCastle throws the following error regardless of SMTP configuration:

Could not complete Send email.
SMTP host is not configured. Please verify your email settings.

Steps to Reproduce

  1. Fresh install of 3.5.0.44 into a clean directory
  2. Place appsettings.console.json in the same directory as PingCastle.exe with the following SMTP section (matching the official documentation and the output of the built-in auto-migration tool):
"Smtp": {
  "From": "pingcastle@domain.com",
  "DeliveryMethod": "Network",
  "Host": "smtp.server.com",
  "Port": 25,
  "UserName": "",
  "Password": ""
}
  1. Run with:
.\PingCastle.exe --healthcheck --server domain.local --sendAllTo admin@domain.com
  1. Observe the SMTP error above.

Additional Diagnostics:

Key finding: Intentionally breaking the JSON syntax in appsettings.console.json (e.g. removing a closing brace) does not produce a parse error — PingCastle returns the exact same SMTP error. This confirms the file is being ignored entirely at runtime.

Auto-migration tool: Running PingCastleAutoUpdater.exe to migrate the working 3.4.1.38 PingCastle.exe.config (XML) to appsettings.console.json (JSON) produces a config structurally identical to the one above, and still results in the same error.

Legacy XML config: Placing a PingCastle.exe.config file with the SMTP section in XML format (which worked in 3.4.1.38) also does not resolve the issue in 3.5.0.44.

Command line flags: Using --smtplogin and --smtppass flags does not resolve the issue either.

Expected Behaviour:
PingCastle should read SMTP settings from appsettings.console.json and successfully send reports to the specified recipients.

Actual Behaviour:
PingCastle ignores appsettings.console.json entirely and reports that SMTP is not configured.

Current Workaround:
None found. Currently rolling back to 3.4.1.38.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions