0
Trying to send mail in the background, using start-job
, but having a problem with passing parameters to the scriptblock.
Mail params define:
$mailParams=@{
To = $AddressTo
From = $AddressFrom
Subject = $Subject
Body = $Body
SMTPServer = $SMTPServer
#BodyAsHTML = $True
#Port = 587
#UseSSL = $True
#Credential = $mailCred
}#End mailParams
Sending mail command:
Send-MailMessage @mailparams
Expected:
start-job -scriptblock {Send-MailMessage @mailparams}
Tried to use start-job -scriptblock {Send-MailMessage} -ArgumentList $mailparams
, but same problem, all params are null
Btw, open for any better suggestion how to execute it in the background
Thanks, works as expected. Yeah, didn't think that way – igor – 2018-08-14T12:07:04.780