-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
28 lines (24 loc) · 890 Bytes
/
main.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
import smtplib, ssl
from email.message import EmailMessage
def send_email():
port = 465
smtp_server = "smtp.gmail.com"
message = EmailMessage()
content = input("Message content: \n")
message.set_content(content)
message["Subject"] = input("E-mail subject: \n")
sender_email = input('Enter your e-mail adress: \n')
message["From"] = sender_email
password = input("Enter your e-mail password: \n")
message['To'] = input('Receiver e-mail: \n')
context = ssl.create_default_context()
with smtplib.SMTP_SSL(smtp_server, port, context=context) as server:
try:
server.login(sender_email, password)
server.send_message(message)
print('E-mail sent !')
server.quit()
except:
print("Could not sent e-mail.")
server.quit()
send_email()