-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleEmailSender.py
More file actions
45 lines (30 loc) · 1020 Bytes
/
SimpleEmailSender.py
File metadata and controls
45 lines (30 loc) · 1020 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! usr/bin/python3
"""
This program recieves the user's sender's and reiceiver's email address,
the subject, message and finally sends it .
"""
import smtplib
from email.mime.text import MIMEText as text
def sendEmail():
try:
receipient = input(" Insert the reciepient's email address >>").lower()
print(" ")
sender= input(" Insert the sender's email address >>").lower()
print(" ")
subject=input("What is the Email SUbject? >>")
print(" ")
message= input(" Compose your message here >>").capitalize()
print(" ")
m=text(message)
m['Subject']= subject
m['From']=sender
m['To']=receipient
server= smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login("youremail@gmail.com","xxxxxx")
server.sendmail(sender,receipient, m.as_string())
server.quit()
print ("Email Successfully Sent")
except:
print ("Email Not Sent")
sendEmail()