HTML email mouse over text

Using python to send hourly reports in HTML. You must turn on the mouse over the text, in other words, when the user hovers over the report title, certain text is displayed.

Tried the following, but it works when you read emails in 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 address, recipient 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)

Any help on what needs to be done to make Outlook display text above text?

+4
source share

All Articles