[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { return $true } $EmailToAddresses = @("test1@test.com", "test2@test.com") $EmailTo = "" $EmailFrom = "it@test.com" $Subject = "subjects" $Body = "FYI" $SMTPServer = "192.1.2.1" $filenameAndPath = "C:\sayhello\sayhello.csv" $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) $SMTPClient.EnableSsl = $true $SMTPClient.Credentials = New-Object System.Net.NetworkCredential("username", "password"); foreach ($EmailTo in $EmailToAddresses) { $SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body) $attachment = New-Object System.Net.Mail.Attachment($filenameAndPath) $SMTPMessage.Attachments.Add($attachment) $SMTPClient.Send($SMTPMessage) }