send edited image to email

This commit is contained in:
Nomi Nonsense (Nonszy) 2023-09-07 23:00:02 +07:00
parent 6e6a4c014f
commit 6d080ca45d

View File

@ -32,7 +32,7 @@ def send_email():
# message variable # message variable
subject = "confirm your account" subject = "confirm your account"
msg = "your OTP code is" msg = "Here's your email confirmation"
zmail = MIMEMultipart() zmail = MIMEMultipart()
zmail['From'] = mail_sender zmail['From'] = mail_sender
@ -43,7 +43,8 @@ def send_email():
zmail.attach(MIMEText(msg, 'plain')) zmail.attach(MIMEText(msg, 'plain'))
# attach picure # attach picure
pict = open('images/main/black-suit.png', 'rb').read(); add_textimg("Your otp code is " + str(randis))
pict = open("images/output/pos.png", "rb").read()
zmail.attach(MIMEImage(pict, name="black man suit")) zmail.attach(MIMEImage(pict, name="black man suit"))
# creating context # creating context
@ -56,4 +57,4 @@ def send_email():
print("Failed to send a email") print("Failed to send a email")
print(str(e)) print(str(e))
add_textimg("Your otp code is 3826") send_email()