【问题标题】:html email mouse over texthtml电子邮件鼠标悬停在文本上
【发布时间】:2014-09-25 20:44:15
【问题描述】:

使用 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 email outlook


    【解决方案1】:

    【讨论】:

    • 谢谢,对于完成我的目标任务的最佳替代方案有什么建议吗?
    • 你做不到,简单明了。对于那个很抱歉。你能做的最好的就是让它在 Outlook 2000 / 2003、Hotmail、Apple Mail 和 Yahoo! 中工作。邮件(您的代码已经在这些客户端上运行)。对此感到抱歉,但出于安全原因,大多数电子邮件客户端都会阻止它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多