```
pwd = "mypassword"
import smtplib

server = smtplib.SMTP('smtp.gmail.com')
server.ehlo()
server.starttls()
server.login("gvpcse113@gmail.com",pwd)

msg = "YOUR MESSAGE!"
server.sendmail("gvpcse113@gmail.com", "sender@xyz.com", msg)
server.quit()

```

I have tried sending a mail through python...  

Error :   

```
Traceback (most recent call last):
  File "H:/my projects/PythonCourse/test_cont/mail_test4.py", line 4, in <module>
    server = smtplib.SMTP('smtp.gmail.com')
  File "C:\Python27\lib\smtplib.py", line 256, in __init__
    (code, msg) = self.connect(host, port)
  File "C:\Python27\lib\smtplib.py", line 316, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "C:\Python27\lib\smtplib.py", line 291, in _get_socket
    return socket.create_connection((host, port), timeout)
  File "C:\Python27\lib\socket.py", line 557, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11001] getaddrinfo failed

```

I am connecting through a proxy connection  

I set the proxy through cmd in windows.
Please help me with this.

**Update :** 

I am sure with the internet connection :   

```
import urllib2

def internet_on():
    try:
        response=urllib2.urlopen('https://www.google.co.in',timeout=1)
        return True
    except urllib2.URLError as err: pass
    return False

print internet_on()

```

Output is `True`