-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abbe699
commit a4b2efa
Showing
2 changed files
with
23 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function Base64-Encode($string) { | ||
$bytes = [System.Text.Encoding]::UTF8.GetBytes($string); | ||
$encoded = [System.Convert]::ToBase64String($bytes); | ||
|
||
return $encoded; | ||
} | ||
|
||
|
||
function Base64-Decode($string) { | ||
$bytes = [System.Convert]::FromBase64String($string); | ||
$decoded = [System.Text.Encoding]::UTF8.GetString($bytes); | ||
|
||
return $decoded; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
Function Send-EMail { | ||
# Requires 'base64-conversion.ps1' | ||
$ScriptDirectory = Split-Path $MyInvocation.MyCommand.Path | ||
. (Join-Path $ScriptDirectory base64-conversion.ps1) | ||
|
||
|
||
|
||
|
||
Function Send-EMail { | ||
Param ( | ||
[Parameter(Mandatory=$true)] | ||
[String]$EmailTo, | ||
|
@@ -27,20 +34,11 @@ | |
|
||
} #End Function Send-EMail | ||
|
||
function Base64-Decode($string) { | ||
$bytes = [System.Convert]::FromBase64String($string); | ||
$decoded = [System.Text.Encoding]::UTF8.GetString($bytes); | ||
|
||
return $decoded; | ||
} | ||
|
||
|
||
|
||
Send-EMail -EmailFrom "[email protected]"` | ||
-EmailTo "[email protected]"` | ||
-Body "Test Body"` | ||
-Subject "Test Subject"` | ||
-Password (Base64-Decode "SGVsbG8gV29ybGQ=") # This isn't "secure" but at least it's not plain text. | ||
|
||
# To get the Base64 representation of your password, just go to | ||
# http://www.opinionatedgeek.com/dotnet/tools/base64encode/ | ||
# http://www.opinionatedgeek.com/dotnet/tools/base64encode/ |