title: How can I send email using Gmail's SMTP without using smtplib?
body: <p>This is my code:</p>
  
  <pre><code>import socket
  import base64
  s=socket.socket()    
  s.connect(('smtp.gmx.com',25))    
  message=s.recv(1024)    
  print message    
  s.send("EHLO gmx\r\n")    
  message=s.recv(1024)    
  print message    
  Username=raw_input("Inesrt Username: ")    
  Password=raw_input("Insert Password: ")    
  UP=("\x00"+Username+"\x00"+Password).encode("base64")    
  UP=UP.strip("\n")    
  print "AUTH PLAIN "+UP    
  s.send("AUTH PLAIN "+UP+"\r\n")    
  message=s.recv(10000000)    
  print message   
  s.send("MAIL FROM:"+Username+"\r\n")    
  message=s.recv(10000)    
  print message    
  To=raw_input("TO:")   
  s.send("RCPT TO:"+To+"\r\n")   
  message=s.recv(10000)  
  print message    
  s.send("DATA\r\n")    
  message=s.recv(100000)    
  print message    
  Subject=raw_input("Subject: ")    
  Text=raw_input("Message:")    
  s.send("Subject: "+Subject+"\r\n\r\n"+Text+"\r\n.\r\n")
  message=s.recv(10000)    
  print message
  s.send("QUIT\r\n")
  message=s.recv(100000)   
  print message   
  s.close()
  </code></pre>
  
  <p>It works for regular email, but it does not work for Gmail or Yahoo. How can I send email using Gmail's SMTP using similar code?</p>