I'm attempting to write a script that sends large amount of test emails to an account. I would like to use a for while loop for the number of emails I would like to send. I receive the error "send-mailmessage: a positional parameter cannot be found that accepts argument 1.
Can you please look at my script below and tell me what I'm missing?
$emailSmtpServer = "ohxxxxxxx.corp.local"
$emailFrom = "aaron@mytest.com"
$emailTo = "aaron.@xxxxx.com", " ella.xxxxxs@cxxxxx.com”
$emailSubject = "Testing e-mail"
$emailBody = @"
Here is a message
From your friendly neighborhood IT guy
"@
$i =1
while ($i -gt 10)
do{Send-MailMessage -To $emailTo -From $emailFrom -Subject $emailSubject -Body $emailBody -SmtpServer $emailSmtpServer $i;
$i++}
Aaron Harris ExchangeSharePointGuy