Search code examples
pythonemailpasswordsemail-client

Password protect for sendEmail


I am writing sendEmail Script from external SMTP Client. I am using my gmail account for sending email.

In this script I need to give my gmail password and username. My question is how can I keep my password encrypted/secure for such programs.

I think to give direct password in a code is bad practice. But if I will use any kind of encryption how it will work for third party client.

Any pointers are much appreciated.


Solution

  • There is a module named getpass in python standard library.

    If you are not fed up with typing your password every time you run the script, I recommend you use it for handling password.

    You can also access keyring service of your system via 3rd library, such as keyring.