dsccommunity / dsccommunity/SqlServerDsc

SqlDatabaseMail: Support for SMTP server credentials

Open
#1,215 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
PowerShell
Stars
385
Forks
224
PR merge metrics
No merged PRs in 30d

Description

Details of the scenario you tried and the problem that is occurring

The SqlServerDatabaseMail resource only supports connecting to SMTP servers that do not require authentication, and does not allow for defining a username and password for the SMTP connection. Depending on the user's environment, this could be a requirement of using DatabaseMail, but another example use case would be for using an email testing service like mailtrap.io, which uses unique SMTP credentials to send incoming emails to one organization's user account or another.

Verbose logs showing the problem

N/A

Suggested solution to the issue

Microsoft.SqlServer.Management.Smo.Mail.MailServer contains settable properties for UseDefaultCredentials and UserName, and provides a method for SetPassword.

Rudimentary testing suggests that if the account requires a password, it must be set for the SMO object regardless of which property is being altered, else the password for the account is unset.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

N/A

SQL Server edition and version the target node is running

N/A

SQL Server PowerShell modules present on the target node

N/A

The operating system the target node is running

N/A

Version and build of PowerShell the target node is running

N/A

Version of the DSC module that was used ('dev' if using current dev branch)

dev

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the SqlServerDatabaseMail resource and inspect how Microsoft.SqlServer.Management.Smo.Mail.MailServer is configured. Trace UseDefaultCredentials, UserName, and SetPassword, then verify the resource can accept and apply SMTP credentials; the issue does not mention specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
authentication, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.