test/13.log_mail.ps1
<#
test mail handler #> Write-Host "EXAMPLE 13" Import-Module ..\uLog.psd1 -Force Remove-Variable -Name uLOG -ErrorAction SilentlyContinue Remove-Variable -Name Log -ErrorAction SilentlyContinue if ($cred -eq $null){ $cred = Get-Credential } $log = New-uLog -NoHeader $mailHandler = New-uLogMail -Name Mail ` -From 'uLog@automotive.com' ` -To 'Sebastien.kaiffer@gfi.fr' ` -Smtp 'smtp.sfr.fr' ` -Credentials $cred $log.AddLogHandler( $mailHandler ) $mailHandler.Keep = $true Log-Info -Message 'Start' Log-Info -Message 'message 1' Log-Info -Message 'message 2' Log-Info -Message 'FINISHED' $mailHandler.Flush() |