-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathscript.py
78 lines (48 loc) · 1.81 KB
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import smtplib
from tkinter import *
def send_message():
address_info = address.get()
email_body_info = email_body.get()
sender_info = sender_address.get()
password_info = password.get()
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(sender_info, password_info)
print("Login successful")
server.sendmail(sender_info, address_info, email_body_info)
print("Message sent")
address_entry.delete(0, END)
email_body_entry.delete(0, END)
password_entry.delete(0, END)
sender_address_entry.delete(0, END)
gui = Tk()
gui.geometry("500x500")
gui.title("Email Sender App")
heading = Label(text="Email Sender App", bg="yellow",
fg="black", font="10", width="500", height="3")
heading.pack()
gui.configure(background="light blue")
sender_address_field = Label(text="Sender's Email :")
sender_address_field.place(x=15, y=70)
sender_address = StringVar()
sender_address_entry = Entry(textvariable=sender_address, width="30")
sender_address_entry.place(x=15, y=100)
sender_password_field = Label(text="Sender's Password :")
sender_password_field.place(x=15, y=140)
password = StringVar()
password_entry = Entry(textvariable=password, width="30")
password_entry.place(x=15, y=170)
address_field = Label(text="Recipient Email :")
address_field.place(x=15, y=210)
address = StringVar()
address_entry = Entry(textvariable=address, width="30")
address_entry.place(x=15, y=240)
email_body_field = Label(text="Message :")
email_body_field.place(x=15, y=280)
email_body = StringVar()
email_body_entry = Entry(textvariable=email_body, width="30")
email_body_entry.place(x=15, y=320, height="30")
button = Button(gui, text="Send Message", command=send_message,
width="30", height="2", bg="grey")
button.place(x=15, y=400)
mainloop()