Three things appear to be missing in the code sequence above:
- you need to use port 587
- a call to
starttls()
is needed to switch to the SSL/TLS protocol - you need to login to the Gmail SMTP server by calling
login
with your gmail username and password.
The last section of your code should now look like this:
s = smtplib.SMTP_SSL("smtp.gmail.com", 587)
s.starttls()
s.login('gmail_username', 'gmail_password')
s.sendmail(me, family, msg.as_string())
s.close()