diff --git a/src/Plugins/Mail.ps1 b/src/Plugins/Mail.ps1 index ad767e9..b6d2581 100644 --- a/src/Plugins/Mail.ps1 +++ b/src/Plugins/Mail.ps1 @@ -8,6 +8,7 @@ param( [string] $Server, [string] $UserName, [string] $Password, + [string] $Domain, [int] $Port, [string[]] $Attachment, [switch] $EnableSsl, @@ -50,7 +51,13 @@ $Attachment | ForEach-Object { if ($_) { $msg.Attachments.Add($_)} } # Send mail message $smtp = new-object Net.Mail.SmtpClient($Server) -if ($UserName) { $smtp.Credentials = new-object System.Net.NetworkCredential($UserName, $Password) } +if ($UserName) { + if ($Domain) { + $smtp.Credentials = New-Object System.Net.NetworkCredential($UserName, $Password, $Domain) + } else { + $smtp.Credentials = New-Object System.Net.NetworkCredential($UserName, $Password) + } +} if ($Port) { $smtp.Port = $Port } $smtp.EnableSsl = $EnableSsl $smtp.Send($msg)