HOW DO  I SEND EMAIL USING POWERSHELL



#################################################################################
# Author: Shailesh Thakur
# Description: Send Email Using Powershell
# Version:1.0
#################################################################################


###############################  Variables Declaration and Definition ################


    $from=Read-Host -Prompt "Enter Your From Email"
    $to=Read-Host -Prompt "Enter Email To Be Sent To"
    $cc=Read-Host -Prompt "Enter Email to CC"
    $subject=Read-Host -Prompt "Enter Subject of Your Email"
    $body=Read-Host -Prompt "Type The Body of the Email"
    $attachment=""
    $SMTPServer = "smtp.gmail.com"
    $SMTPPort = "587"


    Send-MailMessage -From $from -To $to -Subject $subject -Cc $cc -Body $body `
-SmtpServer $SMTPServer -Port $SMTPPort `
-UseSsl -Credential (Get-Credential)

    #################################################################################

Note:One have to configure the from email to send email via program
the following link might be usefull

Comments are welcomed and i am ready to walk you through the code


HAPPY CODING !!!!!😊

Popular posts from this blog

What Happens Under the Hood of SSH Connections? Analyzing SSH Packets with Wireshark.

Certification for Kubernetes? I got it covered.

Continuous Integrations Concepts and Demo