$EmailFrom = “esmondeyong@gmail.com”
$EmailTo = “admin@titanfour.com.my”
$Subject = “Sent from PC PowerShell”
$Body = “What do you want your email to say”
$SMTPServer = “smtp.gmail.com”
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“username”, “password”);
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
- $EmailFrom = Sender's Email address.
- $EmailTo = Recipient’s Email address.
- $Subject = The subject for the Email that you want to send.
- $Body = Content for the Email.
- $SMTPServer = Your email SMTP Server
Change the following under $SMTPCleint.Credentials
- username = Email username
- password = Email password
No comments:
Post a Comment