Category mail

Send mail from command prompt using powershell

Commands: powershell$EmailFrom = “sendermailID@gmail.com”$EmailTo = “receivermailID1@gmail.com,receivermailID2@gmail.com”$Subject = “The subject of your email”$Body = “This is just a test mail to verify the working of CMD”$SMTPServer = “smtp.gmail.com”$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)$SMTPClient.EnableSsl = $true$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“sendermailID@gmail.com”, “senderPassword”)$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)pause

Enable Notifications OK No thanks