Skip to content

Commit 7c6cf88

Browse files
author
GJEBB
committed
Set-MDMail: To and Attachments accept arrays. Bcc and Priority (with enum) added.
1 parent 7f2f3a1 commit 7c6cf88

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

MailDaemon/functions/Invoke-MDDaemon.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@
5353
if ($email.From) { $parameters["From"] = $email.From }
5454
else { $parameters["From"] = Get-PSFConfigValue -FullName 'MailDaemon.Daemon.SenderDefault' }
5555
if ($email.Cc) { $parameters["Cc"] = $email.Cc }
56+
if ($email.Bcc) { $parameters["Bcc"] = $email.Bcc }
5657
if ($email.Subject) { $parameters["Subject"] = $email.Subject }
5758
else { $parameters["Subject"] = "<no subject>" }
59+
if ($email.Priority) {$parameters["Priority"] = $email.Priority}
5860
if ($email.Body) { $parameters["Body"] = $email.Body }
5961
if ($null -ne $email.BodyAsHtml) { $parameters["BodyAsHtml"] = $email.BodyAsHtml }
6062
if ($email.Attachments) {

MailDaemon/functions/Set-MDMail.ps1

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
function Set-MDMail
1+
enum MailPriority {
2+
Normal
3+
Low
4+
High
5+
}
6+
7+
function Set-MDMail
28
{
39
<#
410
.SYNOPSIS
@@ -49,12 +55,15 @@
4955
[string]
5056
$From,
5157

52-
[string]
58+
[string[]]
5359
$To,
5460

5561
[string[]]
5662
$Cc,
5763

64+
[string[]]
65+
$Bcc,
66+
5867
[string]
5968
$Subject,
6069

@@ -64,14 +73,17 @@
6473
[switch]
6574
$BodyAsHtml,
6675

67-
[string]
76+
[string[]]
6877
$Attachments,
6978

7079
[switch]
7180
$RemoveAttachments,
7281

7382
[datetime]
74-
$NotBefore
83+
$NotBefore,
84+
85+
[MailPriority]
86+
$Priority
7587
)
7688

7789
begin
@@ -86,11 +98,13 @@
8698
if ($From) { $script:mail["From"] = $From }
8799
if ($To) { $script:mail["To"] = $To }
88100
if ($Cc) { $script:mail["Cc"] = $Cc }
101+
if ($Bcc) { $script:mail["Bcc"] = $Bcc }
89102
if ($Subject) { $script:mail["Subject"] = $Subject }
90103
if ($Body) { $script:mail["Body"] = $Body }
91104
if ($BodyAsHtml.IsPresent) { $script:mail["BodyAsHtml"] = ([bool]$BodyAsHtml) }
92105
if ($Attachments) { $script:mail["Attachments"] = $Attachments }
93106
if ($RemoveAttachments.IsPresent) { $script:mail["RemoveAttachments"] = ([bool]$RemoveAttachments) }
94107
if ($NotBefore) { $script:mail["NotBefore"] = $NotBefore }
108+
if ($Priority) { $script:mail["Priority"] = $Priority }
95109
}
96110
}

0 commit comments

Comments
 (0)