295 lines
10 KiB
Python
295 lines
10 KiB
Python
import smtplib
|
|||
|
|
from email.header import Header
|
||
|
|
from email.mime.multipart import MIMEMultipart
|
||
|
|
from email.mime.text import MIMEText
|
||
|
|
|
||
|
|
from email.utils import formataddr
|
||
|
|
|
||
|
|
html = """
|
||
|
|
<!DOCTYPE html>
|
||
|
|
<html lang="zh-CN">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
<title>专业微信小程序开发服务</title>
|
||
|
|
<style>
|
||
|
|
body {
|
||
|
|
margin: 0;
|
||
|
|
padding: 0;
|
||
|
|
font-family: "Microsoft YaHei", Arial, sans-serif;
|
||
|
|
background-color: #f4f4f4;
|
||
|
|
color: #333333;
|
||
|
|
line-height: 1.6;
|
||
|
|
}
|
||
|
|
|
||
|
|
.email-container {
|
||
|
|
max-width: 600px;
|
||
|
|
margin: 20px auto;
|
||
|
|
background-color: #ffffff;
|
||
|
|
border-radius: 8px;
|
||
|
|
overflow: hidden;
|
||
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||
|
|
}
|
||
|
|
|
||
|
|
.header {
|
||
|
|
background: linear-gradient(135deg, #07c160 0%, #04a85a 100%);
|
||
|
|
color: white;
|
||
|
|
padding: 30px 20px;
|
||
|
|
text-align: center;
|
||
|
|
}
|
||
|
|
|
||
|
|
.header h1 {
|
||
|
|
margin: 0;
|
||
|
|
font-size: 28px;
|
||
|
|
font-weight: bold;
|
||
|
|
}
|
||
|
|
|
||
|
|
.header p {
|
||
|
|
margin: 10px 0 0;
|
||
|
|
font-size: 16px;
|
||
|
|
opacity: 0.9;
|
||
|
|
}
|
||
|
|
|
||
|
|
.logo {
|
||
|
|
font-size: 48px;
|
||
|
|
margin-bottom: 10px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.content {
|
||
|
|
padding: 30px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.section-title {
|
||
|
|
color: #07c160;
|
||
|
|
border-left: 4px solid #07c160;
|
||
|
|
padding-left: 15px;
|
||
|
|
margin: 25px 0 15px;
|
||
|
|
font-size: 20px;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* --- 修改开始:横向布局样式 --- */
|
||
|
|
.features {
|
||
|
|
display: flex;
|
||
|
|
flex-wrap: wrap; /* 允许换行 */
|
||
|
|
gap: 20px; /* 项目之间的间距 */
|
||
|
|
margin: 20px 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
.feature-item {
|
||
|
|
/* 每个项目占据大约一半的宽度,减去gap的一半 */
|
||
|
|
flex: 1 1 calc(50% - 20px);
|
||
|
|
display: flex;
|
||
|
|
align-items: flex-start;
|
||
|
|
padding: 15px;
|
||
|
|
background-color: #fafafa; /* 可选:给每个卡片加个淡背景 */
|
||
|
|
border-radius: 6px;
|
||
|
|
border: 1px solid #eeeeee;
|
||
|
|
box-sizing: border-box; /* 确保padding不增加总宽度 */
|
||
|
|
}
|
||
|
|
|
||
|
|
/* 当屏幕较宽时,如果想让4个项目排成一行,可以取消下面的注释并调整flex值
|
||
|
|
但通常邮件中2列更清晰。如果需要4列,请将上面的 flex 改为 1 1 23%
|
||
|
|
*/
|
||
|
|
|
||
|
|
.feature-icon {
|
||
|
|
color: #07c160;
|
||
|
|
font-size: 24px;
|
||
|
|
margin-right: 15px;
|
||
|
|
min-width: 30px;
|
||
|
|
text-align: center;
|
||
|
|
}
|
||
|
|
|
||
|
|
.feature-item div:last-child {
|
||
|
|
/* 确保文字部分正确对齐 */
|
||
|
|
flex: 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
.feature-item p {
|
||
|
|
margin: 5px 0 0;
|
||
|
|
font-size: 14px;
|
||
|
|
color: #555;
|
||
|
|
}
|
||
|
|
/* --- 修改结束 --- */
|
||
|
|
|
||
|
|
.benefits {
|
||
|
|
background-color: #f8fff9;
|
||
|
|
border: 1px solid #e0fae6;
|
||
|
|
border-radius: 6px;
|
||
|
|
padding: 20px;
|
||
|
|
margin: 25px 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
.benefit-item {
|
||
|
|
display: block;
|
||
|
|
margin: 8px 0;
|
||
|
|
color: #07c160;
|
||
|
|
font-weight: 500;
|
||
|
|
}
|
||
|
|
|
||
|
|
.cta-button {
|
||
|
|
display: inline-block;
|
||
|
|
background-color: #07c160;
|
||
|
|
color: white;
|
||
|
|
padding: 12px 30px;
|
||
|
|
border-radius: 6px;
|
||
|
|
text-decoration: none;
|
||
|
|
font-weight: bold;
|
||
|
|
margin: 20px 0;
|
||
|
|
text-align: center;
|
||
|
|
border: none;
|
||
|
|
cursor: pointer;
|
||
|
|
font-size: 16px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.cta-button:hover {
|
||
|
|
background-color: #06a556;
|
||
|
|
}
|
||
|
|
|
||
|
|
.footer {
|
||
|
|
background-color: #f8f8f8;
|
||
|
|
padding: 20px 30px;
|
||
|
|
text-align: center;
|
||
|
|
color: #666666;
|
||
|
|
font-size: 14px;
|
||
|
|
border-top: 1px solid #eeeeee;
|
||
|
|
}
|
||
|
|
|
||
|
|
.contact-info {
|
||
|
|
margin: 15px 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
.social-icon {
|
||
|
|
display: inline-block;
|
||
|
|
margin: 0 10px;
|
||
|
|
color: #07c160;
|
||
|
|
font-size: 20px;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* 响应式调整:在小屏幕上恢复为单列或保持两列但调整间距 */
|
||
|
|
@media screen and (max-width: 480px) {
|
||
|
|
.feature-item {
|
||
|
|
flex: 1 1 100%; /* 小屏幕上每个项目占满一行 */
|
||
|
|
}
|
||
|
|
.content {
|
||
|
|
padding: 15px;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div class="email-container">
|
||
|
|
<!-- 邮件头部 -->
|
||
|
|
<div class="header">
|
||
|
|
<div class="logo">📱</div>
|
||
|
|
<h1>专业微信小程序开发</h1>
|
||
|
|
<p>助力企业数字化转型,开启移动营销新纪元</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 邮件内容 -->
|
||
|
|
<div class="content">
|
||
|
|
<h2>尊敬的客户,您好!</h2>
|
||
|
|
|
||
|
|
<p>在移动互联网时代,微信小程序已成为企业连接用户、提升效率、增加营收的重要工具。我们为您提供专业的微信小程序定制开发服务,帮助您的业务在微信生态中快速成长。</p>
|
||
|
|
|
||
|
|
<!-- 核心功能 -->
|
||
|
|
<h3 class="section-title">我们的核心服务</h3>
|
||
|
|
<div class="features">
|
||
|
|
<div class="feature-item">
|
||
|
|
<div class="feature-icon">✨</div>
|
||
|
|
<div>
|
||
|
|
<strong>商城小程序</strong>
|
||
|
|
<p>完整的电商解决方案,支持商品展示、购物车、在线支付、订单管理等功能,助您快速搭建线上商城。</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="feature-item">
|
||
|
|
<div class="feature-icon">🏢</div>
|
||
|
|
<div>
|
||
|
|
<strong>企业展示小程序</strong>
|
||
|
|
<p>展示企业形象、产品服务、新闻动态,提升品牌影响力,让客户随时随地了解您的企业。</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="feature-item">
|
||
|
|
<div class="feature-icon">📅</div>
|
||
|
|
<div>
|
||
|
|
<strong>预约服务小程序</strong>
|
||
|
|
<p>适用于餐饮、美容、医疗、教育等行业,实现在线预约、排班管理、提醒通知等功能。</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="feature-item">
|
||
|
|
<div class="feature-icon">🎮</div>
|
||
|
|
<div>
|
||
|
|
<strong>营销互动小程序</strong>
|
||
|
|
<p>集成了拼团、砍价、秒杀、抽奖等营销工具,帮助您快速裂变获客,提升用户活跃度。</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 核心优势 -->
|
||
|
|
<h3 class="section-title">为什么选择我们?</h3>
|
||
|
|
<div class="benefits">
|
||
|
|
<strong style="color: #333;">我们的优势:</strong>
|
||
|
|
<br>
|
||
|
|
<span class="benefit-item">✅ 专业团队:资深开发工程师,多年小程序开发经验</span>
|
||
|
|
<span class="benefit-item">✅ 定制开发:根据您的业务需求提供个性化解决方案</span>
|
||
|
|
<span class="benefit-item">✅ 快速上线:标准化开发流程,缩短开发周期</span>
|
||
|
|
<span class="benefit-item">✅ 完善售后:提供技术指导、bug修复、功能迭代等服务</span>
|
||
|
|
<span class="benefit-item">✅ 性价比高:合理的价格,优质的服务</span>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 行动号召 -->
|
||
|
|
<div style="text-align: center;">
|
||
|
|
<p><strong>立即咨询,获取免费方案报价!</strong></p>
|
||
|
|
<a href="tel:13800138000" class="cta-button">联系电话:138-0013-8000</a>
|
||
|
|
<p style="margin: 10px 0; font-size: 14px; color: #666;">或添加微信:wx_developer_service 咨询</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<p>期待与您合作,共同打造出色的微信小程序,助力您的业务腾飞!</p>
|
||
|
|
</div>
|
||
|
|
<!-- 邮件底部 -->
|
||
|
|
<div class="footer">
|
||
|
|
<div>© 2026 专业小程序开发服务团队</div>
|
||
|
|
<div class="contact-info">
|
||
|
|
电话:138-0013-8000 | 微信:wx_developer_service<br>
|
||
|
|
邮箱:service@miniprogram-dev.com | 官网:www.miniprogram-dev.com
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<small>本邮件为商业推广,请注意查收。如不感兴趣,可直接忽略或回复"TD"退订。</small>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</body>
|
||
|
|
</html>
|
||
|
|
"""
|
||
|
|
|
||
|
|
|
||
|
|
# SMTP服务器: smtp.163.com
|
||
|
|
|
||
|
|
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"] = "" # 不显示任何收件人(这时达成的效果, 也就是相当于秘密抄送,无需要显示就行了)
|
||
|
|
msg["Subject"] = Header(s=emSubject主题, charset="utf-8", )
|
||
|
|
# msg.attach(MIMEText(emBody内容, "plain", "utf-8"))
|
||
|
|
msg.attach(MIMEText(_text=html, _subtype="html", _charset="utf-8"))
|
||
|
|
try:
|
||
|
|
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)} 位收件人")
|
||
|
|
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", ])
|