Skip to content

Send-MailMessage.Tests.ps1 - failure in 'Can send mail message from user to self using pipeline ' #7592

Closed

Description

NOTE: See also #7591

Steps to reproduce

Start-PSPester -Path ./test/powershell/Modules/Microsoft.PowerShell.Utility/Send-MailMessage.tests.ps1

Expected behavior

The tests pass.

Actual behavior

The tests fails with the error 'A null key is not allowed in a hash literal'

The cause of the failure is the SmtpServer part of the hash table that is piped to Send-MailMessage. Note the '$' before the SmtpServer hash key. This is resolving to an empty string.

$object = [PSCustomObject]@{"To" = $address; "From" = $address; "Subject" = $subject; "Body" = $body; $SmtpServer = '127.0.0.1'}

The fix is to remove the $ from $SmtpServer. Also, the quotes around the other keys are not needed.

Activity

  1. added
    Issue-Bug
    WG-Quality-Test
    on Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugResolution-FixedWG-CmdletsWG-Quality-Test

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions