Advertisement
Guest User

Untitled

a guest
Nov 8th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. from Tkinter import *
  4. import smtplib
  5.  
  6. def SendMail():
  7. #print (gmuser.get(),gmpass.get(),sendto.get(),subject.get()+message.get()) **Testing
  8. domain = '@gmail.com'
  9. print gmuser.get()+domain
  10.  
  11. try:
  12.  
  13. server=smtplib.SMTP_SSL('smtp.gmail.com',465)
  14. server.ehlo()
  15. server.login(gmuser.get()+domain,gmpass.get())
  16. server.sendmail(gmuser.get()+domain,sendto.get()+domain,'Subject: %s\n\n%s' % (subject.get(),message.get()))
  17. server.close()
  18. print 'Sent OK'
  19. except:
  20. print 'error'
  21. print gmuser.get() + domain
  22. print sendto.get() + domain
  23.  
  24. mGUI=Tk()
  25. mGUI.title('Send GMail by noxon@RT')
  26.  
  27. gmuser = Entry(mGUI,justify=RIGHT)
  28. gmpass = Entry(mGUI)
  29. sendto = Entry(mGUI,justify=RIGHT)
  30. subject = Entry(mGUI)
  31. message = Entry(mGUI)
  32.  
  33. Label(mGUI, text="To\t:").grid(row=0)
  34. Label(mGUI, text="Subject\t:").grid(row=1)
  35. Label(mGUI, text="Message\t:").grid(row=2,sticky=W+N)
  36. Label(mGUI, text='Gmail User ').grid(row=8)
  37. Label(mGUI, text='Gmail Pass ').grid(row=9)
  38. Label(mGUI, text='@Gmail.com').grid(row=0,column=2,sticky=W)
  39. Label(mGUI, text='@Gmail.com').grid(row=8,column=2)
  40.  
  41. sendto.grid(row=0, column=1,sticky=W)
  42. subject.grid(row=1, column=1,sticky=W)
  43. message.grid(row=2, column=1,sticky=W+S,ipady=20,rowspan=6,pady=4)
  44. gmuser.grid(row=8, column=1,sticky=W)
  45. gmpass.grid(row=9, column=1,sticky=W)
  46.  
  47. Button(mGUI, text='Quit', command=mGUI.quit).grid(row=10, column=0, sticky=W, pady=4)
  48. Button(mGUI, text='Send', command=SendMail).grid(row=10, column=3, sticky=W, pady=4)
  49.  
  50. mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement