I'm new to python, for my project I need to send mail from python.. I'm getting the following error can someone please help me how to get out of it..

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import smtplib
>>> server=smtplib.SMTP('smtp.gmail.com',587)
>>> server.starttls()
Traceback (most recent call last):
  File "C:\Python34\lib\smtplib.py", line 336, in send
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
  File "C:\Python34\lib\smtplib.py", line 671, in starttls
  File "C:\Python34\lib\smtplib.py", line 569, in ehlo_or_helo_if_needed
    if not (200 <= self.ehlo()[0] <= 299):
  File "C:\Python34\lib\smtplib.py", line 423, in ehlo
    self.putcmd(self.ehlo_msg, name or self.local_hostname)
  File "C:\Python34\lib\smtplib.py", line 349, in putcmd
  File "C:\Python34\lib\smtplib.py", line 339, in send
    raise SMTPServerDisconnected('Server not connected')
smtplib.SMTPServerDisconnected: Server not connected

Check your WIFI connection first.If still doesn't work then you can use my code.There are tutorials on the web for 2.7 only which is a bit annoying, but here is the code I used for 3.3.4

import getpass
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
fromaddr = raw_input("From : ")
toaddr = raw_input("TO :")
p_w_d = getpass.getpass("PASSWORD :")
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = raw_input("SUBJECT OF THE MAIL :")
body = raw_input("YOUR MESSAGE HERE :")
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587)
print "[+] Connecting To Mail Server.\n"
print "[+] Logging Into Mail Server.\n"
server.login(fromaddr, p_w_d)
text = msg.as_string()
print "[+] Sending Mail"
server.sendmail(fromaddr, toaddr, text)
print "[+] Mail Sent Successfully.\n"

It might not work though.