Created
February 19, 2019 02:02
-
-
Save RustyNails8/4b7187849991743fbaaab5621d043753 to your computer and use it in GitHub Desktop.
Send Mail Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# Encrypted AES Key and Password as Secure String are stored on \\myUNCpath #> | |
$encryptedSecureKey = Get-Content \\myUNCpath\smtpKEY.txt | |
$encryptedSecureString = Get-Content \\myUNCpath\smtprelay.txt | |
$secureKey = ConvertTo-SecureString -String $encryptedSecureKey | |
$secureString = ConvertTo-SecureString -String $encryptedSecureString -SecureKey $secureKey | |
$cred = New-Object System.Management.Automation.PSCredential('Domain\User', $secureString) | |
Send-MailMessage -from '[email protected]' -To '[email protected]' -Subject 'TEST mail for VM Action' -Body 'TEST VM Action Mail Bidy' -SmtpServer 'smtp.domain.com' -Credential $cred |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment