diff --git a/README.md b/README.md index eb969a9..8bfc4b7 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ git pull Sample output ````markdown -# Windows Secure Auditor: 0.9.0 +# Windows Secure Auditor: 0.9.1 ## System Information diff --git a/README.zh-TW.md b/README.zh-TW.md index f75bc50..c0f2750 100644 --- a/README.zh-TW.md +++ b/README.zh-TW.md @@ -47,7 +47,7 @@ git pull 範例輸出 ````markdown -# Windows Secure Auditor: 0.9.0 +# Windows Secure Auditor: 0.9.1 ## 系統資訊 diff --git a/SecureAuditor.psd1 b/SecureAuditor.psd1 index d6d96ac..ed83b45 100644 --- a/SecureAuditor.psd1 +++ b/SecureAuditor.psd1 @@ -6,7 +6,7 @@ # RootModule = '' # Version number of this module. - ModuleVersion = '0.9.0' + ModuleVersion = '0.9.1' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/examples/SecureAuditor-SendGrid.ps1 b/examples/SecureAuditor-SendGrid.ps1 index 90def85..2b06b78 100644 --- a/examples/SecureAuditor-SendGrid.ps1 +++ b/examples/SecureAuditor-SendGrid.ps1 @@ -41,15 +41,27 @@ if ($UseSmtp) { } # https://docs.sendgrid.com/api-reference/mail-send/mail-send +[mailaddress]$fromMail = $From $parameters = @{ subject = $subject content = @(@{ type = 'text/plain'; value = $body }) - from = @{ email = $From } - personalizations = New-Object System.Collections.ArrayList + from = @{ email = $fromMail.Address } + personalizations = @( + @{ to = @() } + ) +} + +if (![string]::IsNullOrWhiteSpace($fromaddr.DisplayName)) { + $parameters.from.name = $fromaddr.DisplayName } foreach ($email in $To) { - [void]$parameters.personalizations.Add(@{ to = @( @{ email = $email } ) }) + [mailaddress]$toMail = $email + $recipient = @{ email = $toMail.Address } + if (![string]::IsNullOrWhiteSpace($toMail.DisplayName)) { + $recipient.name = $toMail.DisplayName + } + $parameters.personalizations[0].to += @($recipient) } $json = $parameters | ConvertTo-Json -Depth 4 -Compress