python - 如何创建在线文档以通过 python 记录用户的值?
问题描述
我需要在在线文件中记录用户机器 ID,以检查他们是否有权使用我的程序。
我尝试使用 smtplib 通过电子邮件发送此数据,但我失败了。
import smtplib
host = "smtp.gmail.com',587"
server = smtplib.SMTP(host)
FROM = "testpython@test.com"
TO = 'my_email@gmail.com'
MSG = "Subject: Test email python\n\nBody of your message!"
server.sendmail(FROM, TO, MSG)
server.quit()
print("Email Send")
我也尝试下面的代码
import smtplib
sender = 'from@fromdomain.com'
receivers = ['my_email@gmail.com']
message = """From: From Person <from@fromdomain.com>
To: To Person <my_email@gmail.com>
Subject: SMTP e-mail test
This is a test e-mail message.
"""
try:
smtpObj = smtplib.SMTP('localhost')
smtpObj.sendmail(sender, receivers, message)
print("Successfully sent email")
except:
print("Error: unable to send email")
解决方案
推荐阅读
- python - 从字典列表中创建一个带有漂亮表的表
- ffmpeg - 支持哪些 ffmpeg rtp_mpegts Muxer 选项?(mpegts Muxer 选项被忽略)
- lisp - 将格式应用于展平参数列表而不删除 nil 或子列表元素
- node.js - 如何处理 Node.js 中的 Redis 连接错误?
- c# - 为什么 C# Rx Subscribe() 函数不能与“async”关键字一起使用?
- python - 如何获取用户ID
- swift - 在 swift 中使用 healthKit 的步数总是“0”
- php - 我在 CodeIgniter 中创建了一个控制器和一个视图,但是当我在网站 URL 中提供该控制器名称时,它显示 404
- python - pandas to_datetime 通过参数 #format 获得不同的年份
- node.js - sequelize [erro]{ this.name}.hasMany 中的模型关联使用不是 Sequelize.Model 子类的东西调用