Skip to main content

C# application - Sending email from Gmail with SMTP authentication

If you are getting the below error -

“The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required”
1. Check if you have received an email notification -

We recently blocked a sign-in attempt to your Google Account

Sign-in attempt details
Date & Time:
Location:

2. Check this link and acknoledge the sign in attempt as yours -
https://security.google.com/settings/security/activity

3. Go to this link and enable access to less secure applications
https://www.google.com/settings/security/lesssecureapps

Comments

Popular posts from this blog

Solving PyCharm bug: "Python helpers are not copied yet..."

I have been using PyCharm Professional to run and debug Python code from my Windows machine to a remote Linux device. There are some other tools available for the same purpose (e.g. Python Tool for Visual Studio 2017). But in my opinion, PyCharm Professional stands out among its counterparts as it comes with a "All Batteries Included" setup. Once you configure remote Python interpreter in PyCharm, then it works out of the box. However, today after upgrading to PyCharm Professional 2018.2.1, I could not run my Python script on remote device. The execution always failed with below error - "Error running 'hello': Python helpers are not copied yet to the remote host. Please wait until remote interpreter initialization finishes." To solve this issue, I had to remove the ".pycharm_helpers " folder from the remove device and then restart PyCharm so that the folder is re-created and files are copied again. Here are the steps with comma...

Generating settings.SECRET_KEY in django

On some occasions, there might be a need to generate a random Secret key for your Django project. The easiest option could be starting a django shell and running the below command - from django.core.management. utils import get_random_secret_key get_random_secret_key () However, this may not be safe to use in a production environment. A better option is to use a defined a set of allowed characters including upper case letters and then use Django to generate a long key. Here is an example of it - a. Define a list of allowed characters lower_plus_numbers = ( list ( chr (o) for o in range ( 0x61 , 0x7B )) + list ( chr (o) for o in range ( 0x30 , 0x3A ))) punctuation = list ( '!@#$%^&*(-_=+)' ) upper_alpha = list ( chr (o) for o in range ( 0x41 , 0x5B )) b. Generate Secret Key from django.utils.crypto import get_random_string key_length = 60 get_random_string( key_length, allowed_chars=lower_plus_numbers + punctuation + upper_alpha, ) c...

Threading tutorials from Microsoft

Do you know what’s lurking in the deepest, darkest parts of your thread pool? Take control of that monster and keep your applications responsive by becoming a threading expert with this free 5-part course. Advanced .NET Threading , Part 1: Thread fundamentals Advanced .NET Threading , Part 2: Compute-bound async operations Advanced .NET Threading , Part 3: I/O-bound async operations Advanced .NET Threading , Part 4: Thread synchronization primitives Advanced .NET Threading , Part 5: Thread synchronization locks