HTML tag, <details/> and <summary/> not working in outlook

jack 10 Reputation points
2024-10-31T04:45:55.73+00:00

i am trying to send a HTML body as an email. i am using <details> and <summary> tag to create a dropdown. but i am not able to see the dropdown in outlook desktop app.

here is the code i am using

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


me = ""
you = ""

# Create message container - the correct MIME type is multipart/alternative.
msg = MIMEMultipart("alternative")
msg["Subject"] = "Link"
msg["From"] = me
msg["To"] = you

# Create the body of the message (a plain-text and an HTML version).
html = """\
        <html>
  <body>
    <details>
      <summary>Details</summary>
      <ol>
        <li>data</li>
        <li>other data</li>
      </ol>
    </details>
  </body>
</html>

"""

# Record the MIME types of both parts - text/plain and text/html.
part2 = MIMEText(html, "html")

# Attach parts into message container.
# According to RFC 2046, the last part of a multipart message, in this case
# the HTML message, is best and preferred.
msg.attach(part2)

# Send the message via local SMTP server.
s = smtplib.SMTP("", 25)
# sendmail function takes 3 arguments: sender's address, recipient's address
# and message to send - here it is sent as one string.
s.sendmail(me, you, msg.as_string())
s.quit()

The result i got

User's image

the result i am trying to achieve,(the arrow mark and collapsable content.

User's imageUser's image

i know that outlook uses microsoft word engine to render HTML, is there any other way to achieve this?

please my boss is going to fire me if i don't get this done

i'm on
Microsoft® Outlook® for Microsoft 365 MSO (Version 2408 Build 16.0.17928.20114) 64-bit

Outlook
Outlook
A family of Microsoft email and calendar products.
4,504 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,344 questions
Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
5,815 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.