I wrote a simple script to send an email via the Gmail SMTP server. Here the code:
import smtplib msg = \'Hello World!\' server = smtplib.SMTP(\'smtp.gmail.com\'
The answer recommends enabling access for less secure apps first. If that does not work you could try visiting the link, which is supplied on that page: https://www.google.com/accounts/DisplayUnlockCaptcha
This may enable access.