当前位置:网站首页>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
边栏推荐
- OpenCV 6.4 中值滤波器的使用
- Array and string processing, common status codes, differences between PHP and JS (JS)
- C语言实现XML生成解析库(XML扩展)
- Business architecture diagram
- OpenCV3 6.2 低通滤波器的使用
- Open3d learning note 3 [sampling and voxelization]
- 我的vim配置文件
- Income in the first month of naked resignation
- In depth understanding of prototype drawings
- Using C language to realize MySQL true paging
猜你喜欢
Sqlyog remote connection to MySQL database under centos7 system
Open3d learning notes 1 [first glimpse, file reading]
Look for we media materials from four aspects to ensure your creative inspiration
樂理基礎(簡述)
C语言实现XML生成解析库(XML扩展)
Real world anti sample attack against semantic segmentation
Graph Pooling 简析
Use Matplotlib to draw a preliminary chart
使用Matplotlib绘制图表初步
The internal network of the server can be accessed, but the external network cannot be accessed
随机推荐
Matlab-其它
Global and Chinese markets of tilting feeders 2022-2028: Research Report on technology, participants, trends, market size and share
Chinese garbled code under vscade
I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
Sequence problem for tqdm and print
MySQL optimization
[C # note] the data in DataGridView saved in WinForm is excel and CSV
力扣方法总结:双指针
Global and Chinese market of electric cheese grinder 2022-2028: Research Report on technology, participants, trends, market size and share
How to uninstall SQL Server cleanly
Wang extracurricular words
用C# 语言实现MYSQL 真分页
install. IMG production method
Use of opencv3 6.2 low pass filter
Static library and dynamic library
Global and Chinese market of wire loop, 2022-2028: Research Report on technology, participants, trends, market size and share
Open3d learning notes 1 [first glimpse, file reading]
STL速查手册
SQLyog远程连接centos7系统下的MySQL数据库
MySQL优化