当前位置:网站首页>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
边栏推荐
- I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
- Carsim-实时仿真的动画同步问题
- Embedding malware into neural networks
- On November 24, we celebrate the "full moon"
- Graph Pooling 简析
- JVM instructions
- Summary of solving the Jetson nano installation onnx error (error: failed building wheel for onnx)
- Open3d learning notes 1 [first glimpse, file reading]
- Global and Chinese market of wire loop, 2022-2028: Research Report on technology, participants, trends, market size and share
- WCF更新服务引用报错的原因之一
猜你喜欢

Where do you find the materials for those articles that have read 10000?

针对tqdm和print的顺序问题

Carsim-路面3D形状文件参数介绍

Carsim problem failed to start Solver: Path Id Obj (X) was set to y; Aucune valeur de correction de xxxxx?

Graph Pooling 简析

In the era of short video, how to ensure that works are more popular?

Using transformer for object detection and semantic segmentation

图像增强的几个方法以及Matlab代码

On November 24, we celebrate the "full moon"

STM32疑难杂症之ST-LINK Connection error INVALID ROM TABLE
随机推荐
Summary of one question per day: String article (continuously updated)
MySQL优化
Opencv3 6.3 reduced pixel sampling with filters
力扣方法总结:双指针
Programmers can only be 35? The 74 year old programmer in the United States has been programming for 57 years and has not retired
Get the width and height of the screen in real time (adaptive)
On the back door of deep learning model
Meta Learning 简述
SQL operation database syntax
OpenCV3 6.2 低通滤波器的使用
用C# 语言实现MYSQL 真分页
王-课外单词
Force deduction method summary: find classes
Open3d learning note 3 [sampling and voxelization]
MySQL optimization
Global and Chinese markets for magnetic resonance imaging (MRI) transmission 2022-2028: Research Report on technology, participants, trends, market size and share
Carsim-路面3D形状文件参数介绍
Global and Chinese market of tillage finishing machines 2022-2028: Research Report on technology, participants, trends, market size and share
Using C language to realize MySQL true paging
Global and Chinese market of electric cheese grinder 2022-2028: Research Report on technology, participants, trends, market size and share