当前有一个带有“ info”列和“ contact”列的excel文件。我需要将信息发送给联系人。但是,如果我仅遍历行并为每行发送一封电子邮件,则联系人将收到数百封电子邮件。我如何从每列中获取信息,然后通过一封电子邮件将其发送给正确的联系人?
(sendEmail function is up here)
Do
{
for ($i = 1; $i -le $rowMax - 1; $i++)
{
$words = @"
Hello $contactname, blablabla
"@
$toAddress = $contactemail
$subject = "$warning"
$body = ($words)
Write-Host ("sending email to " + $toAddress)
sendEmail
}
#close excel file
$objExcel.Quit()
} #end of do
While ($node.Length -ne 0)