Send email using PowerShell | Send-MailMessage

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome to cs tutorials i am back with one more video in our powershell tutorial series in this video we'll take a look at how we can send email using powershell scripts so let's start as you can see i already created few variables which i'll use to send email as in normal email we need one sender and one receiver so first two variables from and two are created to store sender and receiver details here i have used my gmail accounts further two variables subject and body are used to store subject line and body of my email next variable smtp server is used to store server details as i am using google count or you can say gmail account i have stored value smtp.gmail.com in this variable next variable dollar cred is used to store my credentials username and password here i have used get credential commandlet it will ask for my credentials at runtime next variable is port so for gmail account port number is 587 and last but not the least send mail message commandlet this commandlet is used to send emails you can use get help command with it to know more about this command with this command few required parameters are to from subject body and smtp server then credential as i'm using my gmail account so i also need to provide use ssl and port number these are also mandatory so once i'll execute this command it will ask me my gmail account username and password and if authentication are passed one email will be triggered and i'll receive that email so let's execute this so i'm entering my password if these are correct i'll get email okay so keep an eye on my gmail account [Music] also so here i have received email which was triggered from powershell script you can open and see subject line is mail from ch tutorials and content is hi dinesh how are you if you are using your gmail account first time from powershell you will get this kind of critical security alert from google which says sign in attempt was tried from non-google app to enable this you have to enable access for less secure app so this is related to gmail account only if you are using some other smtp servers their security guidelines are may be different so you need to follow those only that's all i have for this video if you find this video helpful please like it and share with your friends if you are new to my channel don't forget to subscribe thank you [Music] you
Info
Channel: CS Tutorials
Views: 10,717
Rating: undefined out of 5
Keywords: CS Tutorials, 2021, PowerShell, Send Email, How to, Email, Send-EmailMessage, programming, scripting, how to send an email using Windows PowerShell, how to use PowerShell and the Exchange Management Shell, How to send email using PowerShell script
Id: IpM08xl-NHk
Channel Id: undefined
Length: 5min 13sec (313 seconds)
Published: Mon Jul 26 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.