Sent Mail from Excel Data to SMTP by Powershell
-
Requirement : Send mails to the person whose tickets are pending
Available Resources : Powershell Script to send mail,Filtered Excel Data
Aim :
The tickets are assigned to many persons which is pending for 50 days where many persons having many tickets. So i have filtered the data from the tool and the data which have person login id.I need to send SMTP mail to each person and CC the manager ID with the data.I can get the login id from the Filtered Data
Powershell Script :
$x1 = New-Object -comobject Excel.Application $UserWorkBook = $x1.Workbooks.Open("C:\Location\file.xlsx") $UserWorksheet = $UserWorkBook.Worksheets.Item(1) $UserWorksheet.activate() $rgeSource=$UserWorksheet.range("A1","I32") $rgeSource.Copy() | out-null $Results = Get-Clipboard -TextFormatType Html $message = @{ From = '[email protected]' To = '[email protected]' Subject = "Test Mail -$(Get-Date)" BodyAsHtml = $true } $Server = @{ smtp = 'smtp.domain.com' } $message.Body= "This is the test mail $Results Regards, Username " Send-MailMessage @message @Server
Question :
I have fifty number of person who needs to be sent mail.How to integrate the request with this mail !!!