Posts

Showing posts from August, 2019

How to send emails in outlook using power shell

Powershell is one of the power tool in windows through which we can perform alot of automation through COMObjects. In this example, we are using COMObject for Outlook App installed in the system to perform automation. Note : Outlook App should be installed in the system <#Read Me: Developed By: Name:Vaneeswaran N www.vaneeswaran.com ##Function Name : Send_Email ##Descrption : Used to Send Mail ##Argument : Subject and Body of the Mail #> function Send_Email( $To , $Subject , $Body ) { echo "Sending Email Started.... " try { $olFolderInbox = 6 $Outlook = New-Object -ComObject Outlook.Application $Mail = $Outlook .CreateItem(0) $Mail .To = $To $Mail .Subject = $Subject $Mail .Body = $Body if ( $Body .length -gt 10) #Check to mail body is more than 10 char { ...