当前位置:网站首页>The source code of the live app. When the verification method is mailbox verification, the verification code is automatically sent to the entered mailbox
The source code of the live app. When the verification method is mailbox verification, the verification code is automatically sent to the entered mailbox
2022-07-02 08:14:00 【Cloudleopard network technology】
live broadcast app Source code , When mailbox verification is selected as the verification method , Automatically send the relevant code of the verification code to the entered mailbox
import smtplib
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
# Send multiple types of email
from email.mime.multipart import MIMEMultipart
from PIL import ImageGrab
im = ImageGrab.grab()
im.save('s'+'.png')
msg_from = '[email protected]' # Sender's email
passwd = '66666666666666'
to= ['[email protected]'] # Recipient email
# Set email content
#MIMEMultipart Class can hold anything
msg = MIMEMultipart()
conntent=" This is a string "
# Add in the content
#msg.attach(MIMEText(conntent,'plain','utf-8'))
# Binary read image
image_data=open('1.jpg','rb')
# Set the binary data obtained by reading
message_image = MIMEImage(image_data.read())
# Close the file you just opened
image_data.close()
# Add image files to your email message
#msg.attach(message_image)
# Add attachments
att1=MIMEText(open('result.xlsx','rb').read(),'base64','utf-8') # Open the attachment
att1['Content-Type']='application/octet-stream' # The setting type is streaming media format
att1['Content-Disposition']='attachment;filename=result.xlsx' # Set description information
att2=MIMEText(open('1.jpg','rb').read(),'base64','utf-8')
att2['Content-Type']='application/octet-stream' # The setting type is streaming media format
att2['Content-Disposition']='attachment;filename=1.jpg' # Set description information
msg.attach(att1) # Add to the email
msg.attach(att2)
# Set up email subject
msg['Subject']=" This is the subject of the email "
# Sender information
msg['From']=msg_from
# Start sending
# adopt SSL Mode sending , Server address and port
s = smtplib.SMTP_SSL("smtp.qq.com", 465)
# Login mailbox
s.login(msg_from, passwd)
# Start sending
s.sendmail(msg_from,to,msg.as_string())
print(" Mail sent successfully ")
The above is the live broadcast app Source code , When mailbox verification is selected as the verification method , Automatically send the relevant code of the verification code to the entered mailbox , More content welcome to follow the article
边栏推荐
- 包图画法注意规范
- Prompt 范式简述
- Use of opencv3 6.2 low pass filter
- Use Matplotlib to draw a preliminary chart
- 关于原型图的深入理解
- Wang extracurricular words
- Using C language to realize MySQL true paging
- Array and string processing, common status codes, differences between PHP and JS (JS)
- w10升级至W11系统,黑屏但鼠标与桌面快捷方式能用,如何解决
- Vscode下中文乱码问题
猜你喜欢

STM32疑难杂症之ST-LINK Connection error INVALID ROM TABLE
![Open3d learning notes 1 [first glimpse, file reading]](/img/68/68ea87817dbf788591216a32c9375b.png)
Open3d learning notes 1 [first glimpse, file reading]

Use of opencv3 6.2 low pass filter

Fundamentals of music theory (brief introduction)

MySQL optimization

Use Matplotlib to draw a preliminary chart

Cvpr19 deep stacked hierarchical multi patch network for image deblurring paper reproduction

Carsim-问题Failed to start Solver: PATH_ID_OBJ(X) was set to Y; no corresponding value of XXXXX?

Use of OpenCV 6.4 median filter

OpenCV3 6.2 低通滤波器的使用
随机推荐
Replace convolution with full connection layer -- repmlp
Array and string processing, common status codes, differences between PHP and JS (JS)
VS Code配置问题
OpenCV 6.4 中值滤波器的使用
Sparse matrix storage
Data reverse attack under federated learning -- gradinversion
OpenCV3 6.3 用滤波器进行缩减像素采样
MySQL optimization
SQL operation database syntax
Global and Chinese market of medicine cabinet 2022-2028: Research Report on technology, participants, trends, market size and share
On November 24, we celebrate the "full moon"
Erase method in string
Using C language to realize MySQL true paging
稀疏矩阵存储
深入理解JVM
The internal network of the server can be accessed, but the external network cannot be accessed
Longest isometric subsequence
High school mathematics compulsory one
常量指针和指针常量
[C # note] the data in DataGridView saved in WinForm is excel and CSV