[Python] Send HTML e-mail with a html web page embed in html PYTHON

Discussão em 'Python' iniciado por Stack, Fevereiro 9, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to send an e-mail in html. In the html I want to also embed another html object retrieved in a local folder.

    Below just some part of the code I put in place

    email_content = jinja_template.render(msg)
    msg.attach(MIMEText(email_content, "html"))


    body = f"""<h1> Sales Report </h1> {df.to_html()}
    <img src="cid:image1">`enter code here`
    {% include 'path/to/template.html' %}
    """
    msg.attach(MIMEText(body,'html'))


    Please, give some suggestions.

    Thanks

    Continue reading...

Compartilhe esta Página