ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Sent Mail from Excel Data to SMTP by Powershell

    IT Discussion
    1
    1
    334
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • LakshmanaL
      Lakshmana
      last edited by scottalanmiller

      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 !!!

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post