powershell send-mailmessage credential powershell code example
Example: powershell send-mailmessage authentication
Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Something interesting just happened" -Body "Here's the details about the interesting thing" -SmtpServer smtp.myisp.net -Port 587 -Credential (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "[email protected]",(Get-Content -Path [email protected] | ConvertTo-SecureString))