Send Mail with PowerShell

Send Mail with PowerShell

We can create a basic function to send email with PowerShell by using the following, we will call it Send-SimpleMail. function Send-SimpleMail ([st

IP Address Geo-Location
Disable SSL 2.0/3.0 and TLS 1.0/1.1
Disable/Enable all Network Adapters

We can create a basic function to send email with PowerShell by using the following, we will call it Send-SimpleMail.

function Send-SimpleMail ([string]$subject, [string]$body)
{
$From = "youremail@yourcompany.com"
$To = "recipientemail@yourcompany.com"
$SMTPServer = "smtp.gmail.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($stmpserver, 587)
$SMTPClient.EnableSSL = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("username" "Password");
$SMTPClient.Send($from, $to, $subject, $Body)
}
Send-SimpleMail -subejct "Test-Subject" -body "Testing body text."

COMMENTS

WORDPRESS: 0