PowerShell script to send email using Amazon SES with credentials

Using the below script we can send email from PowerShell using Amazon SES with Credentials Change the smtpServer ,username ,password ,from,to,cc,subject,body ...etc from the first portion of the script

  $smtpServer = "email-smtp.us-east-1.amazonaws.com" 
    $smtpPort = 587  
    $username = "XXXXXXXXXXXXXX"
    $password = "XXXXXXXXXXXXXXXXXXXXX"  
    $from = "info@spiderip.com"
    $to = "info@spgmail.com"
    $subject = "Spiderip Amazon SES Test Email"
    $body = "Spiderip Amazon SES Test Email"
    $cc="infocc@spgmail.com"
    $smtp = new-object Net.Mail.SmtpClient($smtpServer, $smtpPort)
    $smtp.EnableSsl = $true 

    $smtp.Credentials = new-object Net.NetworkCredential($username, $password)
    $msg = new-object Net.Mail.MailMessage
    $msg.From = $from
    $msg.To.Add($to)
    $msg.CC.Add($cc)
    $msg.Subject = $subject
    $msg.Body = $body
    $smtp.Send($msg)

Comments