.. meta:: :description: Send email with table in the body in Python. :keywords: send, email, Python, table, content .. _embedding-tables: Sending Email with Table in Body ================================ You may include tables simply by turning them to raw HTML for example using ``df.to_html()`` in Pandas. However, this often lead to very ugly tables as SMTP is poor at handling CSS or styling in general. Here is a comparison of using ``df.to_html()`` directly vs embedding via Red Mail: |pic1| vs |pic2| .. |pic1| image:: /imgs/table_without_style.png :height: 150px :align: top .. |pic2| image:: /imgs/table_with_style.png :height: 150px :align: top To embed tables, you can simply pass them to the send function as Pandas dataframes: .. code-block:: python # Creating a simple dataframe import pandas as pd df = pd.DataFrame({ 'nums': [1,2,3], 'strings': ['yes', 'no', 'yes'], }) # Let Red Mail to render the dataframe for you: email.send( subject='A prettified table', receivers=['first.last@example.com'], html="