You use the $msg variable to build your .NET mail send object -> $msg = new-object Net.Mail.MailMessage Your declare the object with a wrong "method" This is more something like $emailFrom = somemail@bloh.com # $smtp.Send($msg) Before using this you have to declare this object $emailSmtpServer = "exchange" $emailSmtpServerPort = "587" $SMTP= New-Object System.Net.Mail.SmtpClient( $emailSmtpServer , $emailSmtpServerPort ) And if there are credentials required... $emailSmtpUser = "username" $emailSmtpPass = "password" $SMTPClient.Credentials = New-Object System.Net.NetworkCredential( $emailSmtpUser , $emailSmtpPass );
↧