Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #148 from ComFreek/master
Browse files Browse the repository at this point in the history
Allow setting a custom mail from address
  • Loading branch information
majkinetor authored May 15, 2018
2 parents 8390c95 + 10986fc commit def6c51
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion AU/Plugins/Mail.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
param(
$Info,
[string] $To,
[Parameter(Mandatory=$false)][string] $From,
[string] $Server,
[string] $UserName,
[string] $Password,
Expand All @@ -23,7 +24,10 @@ if (($Info.error_count.total -eq 0) -and !$SendAlways) {
$errors_word = if ($Info.error_count.total -eq 1) {'error'} else {'errors' }

# Create mail message
$from = "Update-AUPackages@{0}.{1}" -f $Env:UserName, $Env:ComputerName

if ($null -eq $From) {
$From = "Update-AUPackages@{0}.{1}" -f $Env:UserName, $Env:ComputerName
}

$msg = New-Object System.Net.Mail.MailMessage $from, $To
$msg.IsBodyHTML = $true
Expand Down

0 comments on commit def6c51

Please sign in to comment.