Articles → POWERSHELL → Send An Email Using Powershell Script
Send An Email Using Powershell Script
Steps
- Open notepad.
- Write following code in notepad
$Outlook = New-Object -ComObject Outlook.Application
$Mail = $Outlook.CreateItem(0)
$Mail.To = "abc@gmail.com"
$Mail.Subject = "Test Subject"
$Mail.Body ="Test mail"
$Mail.Send()
- Save it as test.ps1.
- Right click on the file and click on ‘Run with PowerShell’.