Encrypt Password Before Sending EMail via Hotmail/GMail RRS feed

  • Question

  • Dear All,

    I can use the below script to send mail via GMail:

    send-mailmessage -from -To -Subject "Sending Mail with Attachment" -Body "Hello, Fun with PowerShell and EMail" -Attachments "C:\MyFolder\MyFile.txt" -Priority High -DNO OnSuccess, OnFailure -smtpServer "" -Credential

    The thing is that, this script will prompt me to enter Password for my GMail account. On the other hand, I have the option to enter password in my above script in plain-text. The problem is that whoever reads the script can know my password.

    My question is --- is there anyway I can mention the password in my script in an encrypted format; so that if others are reading my script (or if I share my script) they wont be able to read plain-text password. Password should be written in the script; but not in plain-text. 

    Monday, September 7, 2015 2:14 PM


All replies