· 9 years ago · Nov 08, 2016, 01:04 PM
1#!/usr/bin/python
2
3from Tkinter import *
4import smtplib
5
6def 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
24mGUI=Tk()
25mGUI.title('Send GMail by noxon@RT')
26
27gmuser = Entry(mGUI,justify=RIGHT)
28gmpass = Entry(mGUI)
29sendto = Entry(mGUI,justify=RIGHT)
30subject = Entry(mGUI)
31message = Entry(mGUI)
32
33Label(mGUI, text="To\t:").grid(row=0)
34Label(mGUI, text="Subject\t:").grid(row=1)
35Label(mGUI, text="Message\t:").grid(row=2,sticky=W+N)
36Label(mGUI, text='Gmail User ').grid(row=8)
37Label(mGUI, text='Gmail Pass ').grid(row=9)
38Label(mGUI, text='@Gmail.com').grid(row=0,column=2,sticky=W)
39Label(mGUI, text='@Gmail.com').grid(row=8,column=2)
40
41sendto.grid(row=0, column=1,sticky=W)
42subject.grid(row=1, column=1,sticky=W)
43message.grid(row=2, column=1,sticky=W+S,ipady=20,rowspan=6,pady=4)
44gmuser.grid(row=8, column=1,sticky=W)
45gmpass.grid(row=9, column=1,sticky=W)
46
47Button(mGUI, text='Quit', command=mGUI.quit).grid(row=10, column=0, sticky=W, pady=4)
48Button(mGUI, text='Send', command=SendMail).grid(row=10, column=3, sticky=W, pady=4)
49
50mainloop()