-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendMail.py
More file actions
24 lines (19 loc) · 745 Bytes
/
Copy pathsendMail.py
File metadata and controls
24 lines (19 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from email.message import EmailMessage
from encryptMessage import encrypt_message
import smtplib
def send_email(receiver, subject, body):
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login('sender@gmail.com', 'password')
email = EmailMessage()
email['From'] = 'sender@gmail.com'
email['To'] = receiver
email['Subject'] = encrypt_message(subject)
body = encrypt_message(body)
email.set_content(body)
server.send_message(email)
receiver = input('To whom you want to send the mail')
subject = input('what do you want the subject to be')
body = input('please tell the content of the mail')
send_email(receiver, subject, body)
sendMore = input('Do you want to send another mail')