-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSendMsgUsingGmail.py
More file actions
24 lines (24 loc) · 879 Bytes
/
SendMsgUsingGmail.py
File metadata and controls
24 lines (24 loc) · 879 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
class PythonGmail:
def __init__(self):
self.senderEmail = input("sender mail: ")
self.receiverEmail = input("receiver mail: ")# add no.of receiptents
self.subject = input("Subject: ")
self.text = input("Message: ")
self.message = f"{self.subject}\n\n{self.text}"
def sendmessage(self):
try:
import smtplib
server = smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login(self.senderEmail, 'kghv ilil rsta zbcd')
server.sendmail(self.senderEmail, self.receiverEmail, self.message)
return "Message sent successfully."
except Exception as e:
print("Error: ",e)
def attachFiles(self):
pass
def encryptionPhase(self):
pass
obj1 = PythonGmail()
print(obj1.sendmessage())
print(obj1.sendmessage())