python - html 电子邮件 鼠标悬停在文本上

标签 python html email outlook

使用 python 以 HTML 格式发送每小时报告。需要在文本上启用鼠标,换句话说,当用户将鼠标悬停在报告标题上时,会显示特定文本。

尝试了以下方法,但在 outlook 中阅读电子邮件时确实有效:

from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText

def send_html_email(msg_to_list, msg_from, msg_subject, msg_body, smtp_server):
    ''' set the subject, To, From and body of the email and send it '''
    # Create message container - the correct MIME type is multipart/alternative.
    msg = MIMEMultipart('multipart')
    msg['Subject'] = msg_subject
    msg['From'] = msg_from
    msg['To'] = ', '.join(msg_to_list)
    # Record the MIME type of the HTML body - text/html.
    part = MIMEText(msg_body, 'html')
    # Attach parts into message container.
    msg.attach(part)
    # Send the message via local SMTP server.
    s = smtplib.SMTP(smtp_server)
    # sendmail function takes 3 arguments: sender's address, recipient's address
    # and message to send - here it is sent as one string.
    s.sendmail(msg['From'], msg_to_list, msg.as_string())
    s.quit()


title = 'display this when user moves mouse over this header'
html_msg_body = '''<html><body><div align = "center">'''
html_msg_body += '''<br><br><h3 bgcolor="#00BFFF" title=%s>Stats</h3>'''%(title)
html_msg_body += '<br></body>'
html_msg_body += '<br></html>'


msg_body = html_msg_body
msg_to_list = ['me@test.com']
msg_from = 'me@test.com'
msg_subject = "Stats"
smtp_server = 'localhost'
send_html_email(msg_to_list, msg_from, msg_subject, msg_body, smtp_server)

关于需要做什么才能使 outlook 在文本上显示鼠标的任何帮助?

最佳答案

关于python - html 电子邮件 鼠标悬停在文本上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25100676/

相关文章:

python - 我如何将二进制数转换为整数而不使其为正数

html - 增加html中的特定字母大小

c# - 我如何在 Vista 上设置 smtp 以便我可以使用 System.Net.Mail?

php - 从电子邮件正文中删除 header

mysql - 在 MySQL 中正确存储电子邮件(额外/非必要) header 作为 JSON

javascript - 如何正确地将 js 脚本加载到 html/django 模板中?

python - 将一小时内的每个值分组为一个值,这就是它的平均值

python - 使用 if else 在 dict 中使用 Python 将值设置为键

html - 将图像(垂直和水平)居中在另一个背景图像上?

javascript - 如何在 HTML 文档中使用 javascript 创建一个简单的成本计算器