-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.py
35 lines (32 loc) · 841 Bytes
/
core.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
import cv2
import numpy as np
import uuid
import hashlib
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.image import MIMEImage
from email.mime.text import MIMEText
def get_hashed_value(string):
string = hashlib.sha224(string.encode()).hexdigest()
return str(string)
def generate_private_key():
pass
return str(uuid.uuid4())
def sent_mail(to,sub,message,image = None):
import smtplib
gmail_user = ''
gmail_password = ''
try:
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.ehlo()
server.login(gmail_user, gmail_password)
msg = MIMEMultipart()
if image:
msg.attach(MIMEImage(open(image,"rb").read()))
msg.attach(MIMEText(message,"plain"))
server.sendmail(gmail_user, to, msg.as_string())
server.close()
return True
except Exception as e:
print (e)
return False