About Me

My photo
I am Raghuram Reddy, Adobe Certified Senior ColdFusion Developer (8yrs of exp.) working in Dubai, UAE. Contact me at: raghuramgreddy@gmail.com

Friday, June 18, 2010

Application in python to open browser and login gmail

#!/usr/bin/env python
# This application opens firefox browser and keeps you login : raghuramgreddy@gmail.com
# Note: Before running this application please provide username,password credentials : raghuramgreddy@gmail.com
import SendKeys
import time
import os
import subprocess

FFPATH = os.environ["PROGRAMFILES"] + '\mozilla firefox/firefox.exe'
url = "http://gmail.com"
subprocess.Popen([FFPATH,url])
time.sleep(3)
username = """ grramreddy """
SendKeys.SendKeys(username)
time.sleep(2)
SendKeys.SendKeys('{TAB}')
password = """password """
SendKeys.SendKeys(password)
time.sleep(2)
SendKeys.SendKeys('{TAB 2}')
time.sleep(2)
SendKeys.SendKeys('{ENTER}')
time.sleep(5)
SendKeys.SendKeys('%{SPACE}n')

Comming Soon.......Python::pyWinAuto control applications

Monday, June 7, 2010

Sending an email through gmail using Python

Hi Friends,

Started "hello, world" application last week. I am here to share n develop more n more interesting applications using Python.
Keep Rocking......
Here is the code


#Sending an email through gmail using Python - Raghuram Reddy
import smtplib
fromaddr = 'raghuramgreddy@gmail.com'
toaddrs = 'raghuramgreddy@gmail.com'
msg = 'Email message from PYTHON Raghuram app'

#provide gmail user name and password
username = 'gmailUserName'
password = 'gmailPassword'

# functions to send an email
server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo()
server.starttls()
server.ehlo()
server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()

Comming Soon.......Python::pyWinAuto control applications