I would like to know how do you send mailmessage from displayname? I think we should add New-Object System.Net.Mail.MailMessage to the script but im not sure how to do it..?
$Mail = @{
'To' = 'someone@domain.com'
'From' = 'me@domain.com','Lastname, Firstname' #I dont know what to do here
'Subject' = "TEST NOTIFICATION"
'SMTPServer' = 'mail.domain.com'
'Encoding' = 'UTF8'
'Priority' = 'High'
'Body' = "Hi, this is a test"
}
Send-MailMessage @Mail
>Solution :
Use the following format: Display Name <sender-address>:
$Mail = @{
'To' = 'someone@domain.com'
'From' = 'Lastname, Firstname <me@domain.com>'
'Subject' = "TEST NOTIFICATION"
'SMTPServer' = 'mail.domain.com'
'Encoding' = 'UTF8'
'Priority' = 'High'
'Body' = "Hi, this is a test"
}
Send-MailMessage @Mail