小编Rio*_*Rio的帖子

使用api在github中生成个人访问令牌

有什么方法可以通过我的用户名和密码登录我的 github 帐户并使用 api 生成个人访问令牌吗?

github-api

10
推荐指数
2
解决办法
7952
查看次数

使用python脚本发送带有嵌入式图像的html电子邮件

我是Python的新手。我想发送基于HTML的电子邮件,在电子邮件正文的左上方嵌入公司徽标。

使用以下代码,该电子邮件绝对有效,但不再附加嵌入式图像。不知道我在哪里做错了。任何人都可以在这里帮助我。

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.MIMEImage import MIMEImage

msg = MIMEMultipart('alternative')
msg['Subject'] = "My text dated %s" % (today)
            msg['From'] = sender
            msg['To'] = receiver

html = """\
<html>
<head></head>
<body>
  <img src="cid:image1" alt="Logo" style="width:250px;height:50px;"><br>
  <p><h4 style="font-size:15px;">Some Text.</h4></p>
</body>
</html>
"""

# The image file is in the same directory as the script
fp = open('logo.png', 'rb')
msgImage = MIMEImage(fp.read())
fp.close()

msgImage.add_header('Content-ID', '<image1>')
msg.attach(msgImage)

part2 = MIMEText(html, 'html')
msg.attach(part2)

mailsrv = smtplib.SMTP('localhost') …
Run Code Online (Sandbox Code Playgroud)

python email

2
推荐指数
1
解决办法
2176
查看次数

标签 统计

email ×1

github-api ×1

python ×1