2014-03-05 3 views
0

나는 아래 스크립트를 사용하여 powershell 스크립트에서 전자 메일을 보냅니다.여러 개의 reciepients에 보내기 powershell

$smtpServer = "mail.company.com" 
$smtpFrom = "Check <[email protected]>" 
$smtpTo = "[email protected]" 
$messageSubject = "Daily Check from $thedate" 

$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto 
$message.Subject = $messageSubject 
$message.IsBodyHTML = $true 

$message.Body = $Body | ConvertTo-HTML -head $style -body $Body 

$smtp = New-Object Net.Mail.SmtpClient($smtpServer) 
$smtp.Send($message) 

그것은 내가 같이 더 reciepients를 추가 전까지 잘 작동 ...

$smtpTo = "[email protected]", "[email protected]" 

나는 또한이 같은 배열의 내부를 퍼팅 시도 ....의

$smtpTo = @("[email protected]", "[email protected]") 

없음 그들은 나를 위해 일한다. 누군가가 도울 수 있기를 바랍니다.

+0

"[email protected]; [email protected]"이 트릭을하고 있습니까? – Jenson

+0

아니요, 계속 ""지정된 문자열이 전자 메일에 필요한 형식이 아닙니다. " – user2959441

+0

이 try try this http://stackoverflow.com/questions/10241816/powershell-send-mailmessage-email-to-multiple- 수신자 – Jenson

답변

관련 문제