Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- from Tkinter import *
- import smtplib
- def SendMail():
- #print (gmuser.get(),gmpass.get(),sendto.get(),subject.get()+message.get()) **Testing
- domain = '@gmail.com'
- print gmuser.get()+domain
- try:
- server=smtplib.SMTP_SSL('smtp.gmail.com',465)
- server.ehlo()
- server.login(gmuser.get()+domain,gmpass.get())
- server.sendmail(gmuser.get()+domain,sendto.get()+domain,'Subject: %s\n\n%s' % (subject.get(),message.get()))
- server.close()
- print 'Sent OK'
- except:
- print 'error'
- print gmuser.get() + domain
- print sendto.get() + domain
- mGUI=Tk()
- mGUI.title('Send GMail by noxon@RT')
- gmuser = Entry(mGUI,justify=RIGHT)
- gmpass = Entry(mGUI)
- sendto = Entry(mGUI,justify=RIGHT)
- subject = Entry(mGUI)
- message = Entry(mGUI)
- Label(mGUI, text="To\t:").grid(row=0)
- Label(mGUI, text="Subject\t:").grid(row=1)
- Label(mGUI, text="Message\t:").grid(row=2,sticky=W+N)
- Label(mGUI, text='Gmail User ').grid(row=8)
- Label(mGUI, text='Gmail Pass ').grid(row=9)
- Label(mGUI, text='@Gmail.com').grid(row=0,column=2,sticky=W)
- Label(mGUI, text='@Gmail.com').grid(row=8,column=2)
- sendto.grid(row=0, column=1,sticky=W)
- subject.grid(row=1, column=1,sticky=W)
- message.grid(row=2, column=1,sticky=W+S,ipady=20,rowspan=6,pady=4)
- gmuser.grid(row=8, column=1,sticky=W)
- gmpass.grid(row=9, column=1,sticky=W)
- Button(mGUI, text='Quit', command=mGUI.quit).grid(row=10, column=0, sticky=W, pady=4)
- Button(mGUI, text='Send', command=SendMail).grid(row=10, column=3, sticky=W, pady=4)
- mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement