代码拉取完成,页面将自动刷新
同步操作将从 qpy-doc-center/teedoc_with_qpydoc 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import subprocess, os
path = os.path.dirname(os.path.abspath(__file__))
test_list = ["13866067773@163.com"]
email_list = ["chavis.chen@quectel.com"," pinky.yang@quectel.com"," hayley.wang@quectel.com"," jun.wu@quectel.com"," yironny.he@quectel.com"," eric.ye@quectel.com"," shirly.wang@quectel.com"," aimee.liu@quectel.com"," kawhi.he@quectel.com"," simona.huang@quectel.com"," barry.liu@quectel.com"," anne.qiu@quectel.com"," eliana.wei@quectel.com"," jocelyn.tan@quectel.com"]
def send_email(to_emails, smtp_server, port, username, password, label, url):
subject = "QuecPython 官网更新通知【请勿回复】"
body_text = "QuecPython 官网更新通知【请勿回复】"
body_html = """\
<html>
<head></head>
<body>
<h1>Dear all:</h1>
<p>QuecPython 官网已更新</p>
<p>分支信息: release 分支</p>
<a :href="{}" target="_blank">提交变更: {}</a>
</body>
</html>
""".format(url, url)
msg = MIMEMultipart('alternative')
msg['Subject'] = subject
msg['From'] = username
msg['To'] = ', '.join(to_emails) # 将收件人列表转换为逗号分隔的字符串
# 添加文本内容
part_text = MIMEText(body_text, 'plain')
msg.attach(part_text)
# 添加HTML内容
if body_html:
part_html = MIMEText(body_html, 'html')
msg.attach(part_html)
# 连接SMTP服务器并发送邮件
try:
server = smtplib.SMTP(smtp_server, port)
server.starttls() # 启用安全传输
server.login(username, password)
server.sendmail(username, to_emails, msg.as_string()) # 发送给多个收件人
server.quit()
print("Emails sent successfully to all recipients.")
except Exception as e:
print(f"Error sending emails: {e}")
# 示例使用
# chavis.chen@quectel.com; pinky.yang@quectel.com; hayley.wang@quectel.com; jun.wu@quectel.com; yironny.he@quectel.com; eric.ye@quectel.com; shirly.wang@quectel.com; aimee.liu@quectel.com; kawhi.he@quectel.com; simona.huang@quectel.com; barry.liu@quectel.com; anne.qiu@quectel.com; eliana.wei@quectel.com; jocelyn.tan@quectel.com
to_emails = email_list # 收件人列表
smtp_server = 'smtp.qq.com' # 替换为你的SMTP服务器地址
port = 587 # 或者根据你的邮件服务商使用465
username = '1520483071@qq.com'
password = 'ycqelqfmuryaigjb' # 替换为你的邮箱密码
def get_commit_id():
base_url = 'https://gitee.com/qpy-doc-center/teedoc_with_qpydoc/compare/'
git_rev_parse_command = ['git', 'rev-parse', '--verify', 'HEAD']
last_full_commit_id = subprocess.check_output(git_rev_parse_command, cwd=path, text=True).strip()
last_commit_id = last_full_commit_id[:7]
# subprocess.check_output( ['git', 'pull'], cwd=path, text=True).strip()
rev_full_commit_id = subprocess.check_output(git_rev_parse_command, cwd=path, text=True).strip()
rev_commit_id = rev_full_commit_id[:7]
url = base_url + last_full_commit_id + '...' + rev_full_commit_id
label = '%s...%s' % (last_commit_id, rev_commit_id)
return label, url
if __name__ == '__main__':
label, url = get_commit_id()
send_email(to_emails, smtp_server, port, username, password, label, url)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。