six_005
This commit is contained in:
@@ -267,12 +267,12 @@ html = """
|
||||
|
||||
# SMTP服务器: smtp.163.com
|
||||
|
||||
def send_email_bcc_only(emSubject主题, emBody内容, to_emails):
|
||||
def send_email_bcc_only(emSubject主题, emBody内容, to_emails_收件人列表):
|
||||
"""只有 BCC 收件人,TO 字段为空"""
|
||||
from_email = "792282@qq.com"
|
||||
password = "epagsnfwzrkrbgfa"
|
||||
display_name = "六果科技"
|
||||
|
||||
|
||||
msg = MIMEMultipart()
|
||||
msg["From"] = formataddr(pair=("免费小程序已送达", "792282@qq.com"), charset="utf-8")
|
||||
msg["To"] = "" # 不显示任何收件人(这时达成的效果, 也就是相当于秘密抄送,无需要显示就行了)
|
||||
@@ -283,12 +283,12 @@ def send_email_bcc_only(emSubject主题, emBody内容, to_emails):
|
||||
with smtplib.SMTP_SSL("smtp.qq.com", 465) as emServer:
|
||||
emServer.login(from_email, password)
|
||||
# ✅ 所有收件人都在 to_addrs 中,但不会显示在邮件头
|
||||
emServer.sendmail(from_email, to_emails, msg.as_string())
|
||||
print(f"邮件已密送给 {len(to_emails)} 位收件人")
|
||||
emServer.sendmail(from_email, to_emails_收件人列表, msg.as_string())
|
||||
print(f"邮件已密送给 {len(to_emails_收件人列表)} 位收件人")
|
||||
except Exception as e:
|
||||
print(f"发送失败: {e}")
|
||||
|
||||
|
||||
# 使用
|
||||
recipients = ["xiao@xiao.band", "13382551360@163.com"]
|
||||
send_email_bcc_only(emSubject主题="数字化", emBody内容="邮件的内容", to_emails=["xiao@xiao.band", ])
|
||||
send_email_bcc_only(emSubject主题="数字化", emBody内容="邮件的内容", to_emails_收件人列表=["792282@qq.com", ])
|
||||
|
||||
Reference in New Issue
Block a user